memos/main.go

30 lines
440 B
Go
Raw Normal View History

2021-12-08 18:43:14 +03:00
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)
2021-12-09 17:02:57 +03:00
api.RegisterMemoRoutes(r)
api.RegisterQueryRoutes(r)
spa := api.SPAHandler{
StaticPath: "./web/dist",
IndexPath: "index.html",
}
r.PathPrefix("/").Handler(spa)
2021-12-08 18:43:14 +03:00
http.ListenAndServe("localhost:8080", r)
}