memos/server/main.go

32 lines
503 B
Go
Raw Normal View History

2021-12-08 23:43:14 +08:00
package main
import (
"memos/api"
"memos/store"
"net/http"
"github.com/gorilla/mux"
)
func main() {
store.InitDBConn()
r := mux.NewRouter().StrictSlash(true)
api.RegisterAuthRoutes(r)
2021-12-10 15:14:20 +08:00
api.RegisterUserRoutes(r)
2021-12-09 22:02:57 +08:00
api.RegisterMemoRoutes(r)
api.RegisterQueryRoutes(r)
api.RegisterResourceRoutes(r)
2022-01-09 11:44:12 +08:00
api.RegisterWebHooksRoutes(r)
2021-12-09 22:02:57 +08:00
2021-12-12 21:49:46 +08:00
webServe := api.SPAHandler{
2021-12-09 22:02:57 +08:00
StaticPath: "./web/dist",
IndexPath: "index.html",
}
2021-12-12 21:49:46 +08:00
r.PathPrefix("/").Handler(webServe)
2021-12-08 23:43:14 +08:00
2021-12-12 11:43:27 +08:00
http.ListenAndServe(":8080", r)
2021-12-08 23:43:14 +08:00
}