Skip to content
  • Projects
  • Groups
  • Snippets
  • Help

xuzhenhao / rlw-dev

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • rlw-dev
  • ..
  • fileserver
  • main.go
  • chencheng's avatar
    "初始化提交" · 6e3f6187
    chencheng committed Dec 08, 2017
    6e3f6187
main.go 363 Bytes
BlameHistoryPermalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
package main

import (
	"net/http"
	"os"
	"path/filepath"

	"github.com/meiqia/chi"
)

func main() {
	r := chi.NewRouter()

	r.Get("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("hi"))
	})

	workDir, _ := os.Getwd()
	filesDir := filepath.Join(workDir, "files")
	r.FileServer("/files", http.Dir(filesDir))

	http.ListenAndServe(":3333", r)
}