静态前端
This commit is contained in:
5
main.go
5
main.go
@@ -34,8 +34,11 @@ func main() {
|
||||
})
|
||||
})
|
||||
|
||||
// 設定靜態資源 (前端) 位于public目录下
|
||||
r.PathPrefix("/").Handler(http.FileServer(http.Dir("./public/")))
|
||||
|
||||
// 設定路由
|
||||
r.HandleFunc("/", routers.GetDocs).Methods("GET")
|
||||
r.HandleFunc("/api", routers.GetDocs).Methods("GET")
|
||||
|
||||
r.HandleFunc("/api/users", routers.UsersGet).Methods("GET")
|
||||
r.HandleFunc("/api/users", routers.UsersPost).Methods("POST")
|
||||
|
Reference in New Issue
Block a user