You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
809 B
46 lines
809 B
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"varia.zone/snackbar/components"
|
|
|
|
"github.com/a-h/templ"
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
)
|
|
|
|
// App is the application state.
|
|
type App struct {
|
|
ctx context.Context
|
|
}
|
|
|
|
// NewApp creates a new application state.
|
|
func NewApp() *App {
|
|
return &App{}
|
|
}
|
|
|
|
func (a *App) startup(ctx context.Context) {
|
|
a.ctx = ctx
|
|
}
|
|
|
|
func (a App) domReady(ctx context.Context) {
|
|
}
|
|
|
|
func (a *App) beforeClose(ctx context.Context) (prevent bool) {
|
|
return false
|
|
}
|
|
|
|
func (a *App) shutdown(ctx context.Context) {
|
|
}
|
|
|
|
// NewRouter creates a new web router.
|
|
func NewRouter() *chi.Mux {
|
|
router := chi.NewRouter()
|
|
router.Use(middleware.Logger)
|
|
router.Use(middleware.Recoverer)
|
|
|
|
router.Get("/", templ.Handler(components.NewSiteForm("/")).ServeHTTP)
|
|
|
|
return router
|
|
}
|
|
|