mirror of
https://github.com/usememos/memos.git
synced 2024-12-29 00:21:52 +08:00
31 lines
503 B
Go
31 lines
503 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.RegisterAuthRoutes(r)
|
|
api.RegisterUserRoutes(r)
|
|
api.RegisterMemoRoutes(r)
|
|
api.RegisterQueryRoutes(r)
|
|
api.RegisterResourceRoutes(r)
|
|
api.RegisterWebHooksRoutes(r)
|
|
|
|
webServe := api.SPAHandler{
|
|
StaticPath: "./web/dist",
|
|
IndexPath: "index.html",
|
|
}
|
|
|
|
r.PathPrefix("/").Handler(webServe)
|
|
|
|
http.ListenAndServe(":8080", r)
|
|
}
|