-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (36 loc) · 1.41 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
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/query", handler.FileQueryHandler)
http.HandleFunc("/file/download", handler.DownloadHandler)
http.HandleFunc("/file/update", handler.FileMetaUpdateHandler)
http.HandleFunc("/file/delete", handler.FileDeleteHandler)
http.HandleFunc("/file/downloadurl", handler.HTTPInterceptor(
handler.DownloadURLHandler))
http.HandleFunc("/user/signup", handler.SignupHandler)
http.HandleFunc("/user/signin", handler.SigninHandler)
http.HandleFunc("/user/info", handler.HTTPInterceptor(handler.UserInfoHandler))
http.HandleFunc("/user/fastupload", handler.HTTPInterceptor(handler.TryFastUploadHandler))
// 分块上传接口
http.HandleFunc("/file/mpupload/init",
handler.HTTPInterceptor(handler.InitialMultipartUploadHandler))
http.HandleFunc("/file/mpupload/uppart",
handler.HTTPInterceptor(handler.UploadPartHandler))
http.HandleFunc("/file/mpupload/complete",
handler.HTTPInterceptor(handler.CompleteUploadHandler))
err := http.ListenAndServe(":8080", nil)
if err != nil {
fmt.Printf("Failed to start server, err: %s", err.Error())
}
}