memos/main.go
2021-12-09 22:02:57 +08:00

30 lines
440 B
Go

package main
import (
"memos/api"
"memos/store"
"net/http"
"github.com/gorilla/mux"
)
func main() {
store.InitDBConn()
r := mux.NewRouter().StrictSlash(true)
api.RegisterUserRoutes(r)
api.RegisterAuthRoutes(r)
api.RegisterMemoRoutes(r)
api.RegisterQueryRoutes(r)
spa := api.SPAHandler{
StaticPath: "./web/dist",
IndexPath: "index.html",
}
r.PathPrefix("/").Handler(spa)
http.ListenAndServe("localhost:8080", r)
}