forked from Java-Edge/Go-Cloud-Store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (25 loc) · 950 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"../filestore-server/handler"
"fmt"
"net/http"
)
func main() {
// 设定路由规则
http.Handle("/static/",
http.StripPrefix("/static/", http.FileServer(http.Dir("./static"))))
http.HandleFunc("/file/upload", handler.UploadHandler)
http.HandleFunc("/file/upload/suc", handler.UploadSucHandler)
http.HandleFunc("/file/meta", handler.GetFileMetaHandler)
http.HandleFunc("/file/download", handler.DownloadHandler)
http.HandleFunc("/file/query", handler.FileQueryHandler)
http.HandleFunc("/file/update", handler.FileMetaUpdateHandler)
http.HandleFunc("/file/delete", handler.FileDeleteHandler)
http.HandleFunc("/user/signup", handler.SignupHandler)
http.HandleFunc("/user/signin", handler.SigninHandler)
http.HandleFunc("/user/info", handler.HTTPInterceptor(handler.UserInfoHandler))
err := http.ListenAndServe(":8080", nil)
if err != nil {
fmt.Printf("Failed to start server,err:%s", err.Error())
}
}