mercury/web/routes.go

25 lines
643 B
Go
Raw Normal View History

2023-09-03 00:23:48 +02:00
package web
import (
"git.sleepycat.moe/sam/mercury/web/app"
2023-09-03 04:11:56 +02:00
"git.sleepycat.moe/sam/mercury/web/auth"
2023-09-03 00:23:48 +02:00
"git.sleepycat.moe/sam/mercury/web/frontend"
2023-09-03 04:11:56 +02:00
"github.com/go-chi/chi/v5"
2023-09-03 00:23:48 +02:00
)
func Routes(app *app.App) {
2023-09-03 04:11:56 +02:00
// auth
app.Router.Route("/auth", func(r chi.Router) {
auth := auth.New(app)
r.Get("/login", auth.GetLogin)
})
// web app handlers
// also assets
2023-09-03 00:23:48 +02:00
frontend := frontend.New(app)
app.Router.HandleFunc(frontend.AssetsPath(), frontend.ServeAssets)
2023-09-03 04:11:56 +02:00
app.Router.HandleFunc("/static/*", frontend.ServeStaticAssets)
2023-09-03 00:23:48 +02:00
app.Router.HandleFunc("/web", frontend.ServeFrontend)
app.Router.HandleFunc("/web/*", frontend.ServeFrontend)
}