-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
59 lines (39 loc) · 1.58 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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/success",handler.UploadSucHandler)
http.HandleFunc("/file/meta",handler.GetFileMetaHandler)
http.HandleFunc("/file/download",handler.DownloadHandler)
http.HandleFunc("/file/downloadurl",handler.DownloadHandler)
http.HandleFunc("/user/signup",handler.SignUpHandler)
http.HandleFunc("/user/signin",handler.SignInHandler)
http.HandleFunc("/static/view/signin.html",handler.SignInHandler)
http.HandleFunc("/static/view/home.html",handler.HomeHandler)
http.HandleFunc("/user/info",handler.HTTPInterceptor(handler.UserInfoHandle))
http.HandleFunc("/file/query",handler.FileQueryHandler)
// 秒传接口
http.HandleFunc("/file/fastupload", handler.HTTPInterceptor(
handler.TryFastUploadHandler))
// 分块上传接口
http.HandleFunc("/file/mpupload/init",
handler.HTTPInterceptor(handler.InitMulitPartUploadHandler))
http.HandleFunc("/file/mpupload/uppart",
handler.HTTPInterceptor(handler.UploadPartHandler))
http.HandleFunc("/file/mpupload/complete",
handler.HTTPInterceptor(handler.CompleteUoloadHandler))
http.HandleFunc("/file/mpupload/cancel",
handler.HTTPInterceptor(handler.CancelUploadHandler))
http.HandleFunc("/file/mpupload/status",
handler.HTTPInterceptor(handler.MulitPartUploadHandler))
err := http.ListenAndServe(":8080",nil)
if err != nil {
fmt.Printf("server error:%s \n",err)
}
}