-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (30 loc) · 1.33 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
package main
import (
"flie_store_server/handler"
"fmt"
"net/http"
)
func main() {
fs := http.FileServer(http.Dir("static/"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
http.HandleFunc("/file/upload", handler.UploadHandler)
http.HandleFunc("/file/upload/success", handler.UploadSuccessHandler)
http.HandleFunc("/file/meta", handler.GetFileMetaHandler)
http.HandleFunc("/file/query", handler.FileMetaQueryHandler)
http.HandleFunc("/file/download", handler.DownloadHandler)
http.HandleFunc("/file/update", handler.FileUpdateMetaHandler)
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))
http.HandleFunc("/file/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))
//验证 cat `ls | sort -n` > /tmp/a
err := http.ListenAndServe(":9999", nil)
if err != nil {
fmt.Println("start server failed, err:", err)
return
}
}