picgo/router/router.go

21 lines
543 B
Go
Raw Normal View History

2024-07-11 21:25:58 +08:00
package router
import (
"net/http"
"picgo/handler"
)
func InitRouter() *http.ServeMux {
var mux *http.ServeMux
// 创建新的路由器
mux = http.NewServeMux()
2024-07-12 20:32:33 +08:00
mux.HandleFunc("/", handler.IndexHandler)
mux.HandleFunc("/settings", handler.SettingsHandler)
mux.HandleFunc("/profile", handler.ProfileHandler)
2024-07-11 21:25:58 +08:00
mux.HandleFunc("/static/", handler.StaticHandler)
2024-07-12 20:32:33 +08:00
mux.HandleFunc("/login", handler.LoginHandler)
2024-07-11 21:25:58 +08:00
mux.HandleFunc("/api/v1/upload", handler.UploadFileHandler)
2024-07-12 20:32:33 +08:00
mux.HandleFunc("/captcha", handler.CaptchaHandler)
2024-07-11 21:25:58 +08:00
return mux
}