mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-18 08:50:24 +08:00
优化后端api命名
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user