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.RegisterAuthRoutes(r)
|
2021-12-10 10:14:20 +03:00
|
|
|
api.RegisterUserRoutes(r)
|
2021-12-09 17:02:57 +03:00
|
|
|
api.RegisterMemoRoutes(r)
|
|
|
|
api.RegisterQueryRoutes(r)
|
|
|
|
|
2021-12-12 16:49:46 +03:00
|
|
|
webServe := api.SPAHandler{
|
2021-12-09 17:02:57 +03:00
|
|
|
StaticPath: "./web/dist",
|
|
|
|
IndexPath: "index.html",
|
|
|
|
}
|
|
|
|
|
2021-12-12 16:49:46 +03:00
|
|
|
r.PathPrefix("/").Handler(webServe)
|
2021-12-08 18:43:14 +03:00
|
|
|
|
2021-12-12 06:43:27 +03:00
|
|
|
http.ListenAndServe(":8080", r)
|
2021-12-08 18:43:14 +03:00
|
|
|
}
|