1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-18 08:50:24 +08:00

优化后端api命名

This commit is contained in:
源文雨
2023-03-19 00:03:42 +08:00
parent b795564785
commit d4fb0e4563
2 changed files with 3 additions and 3 deletions

View File

@@ -179,8 +179,8 @@ func init() {
}} }}
} }
// Handler serves all backend /api call // APIHandler serves all backend /api call
func Handler(w http.ResponseWriter, r *http.Request) { func APIHandler(w http.ResponseWriter, r *http.Request) {
if r.URL.Path[0] != '/' { if r.URL.Path[0] != '/' {
r.URL.Path = "/" + r.URL.Path r.URL.Path = "/" + r.URL.Path
} }

View File

@@ -29,7 +29,7 @@ func main() {
os.Exit(line()) os.Exit(line())
} }
http.HandleFunc("/api/", backend.Handler) http.HandleFunc("/api/", backend.APIHandler)
http.HandleFunc("/file/", backend.FileHandler) http.HandleFunc("/file/", backend.FileHandler)
http.HandleFunc("/upload", backend.UploadHandler) http.HandleFunc("/upload", backend.UploadHandler)