diff --git a/main.go b/main.go index fe69abf..49d36e5 100644 --- a/main.go +++ b/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")