Files
crowsnest/golang/cmd/frontend/routes.go

20 lines
393 B
Go
Raw Normal View History

2025-01-02 16:21:02 +01:00
package main
import (
"net/http"
)
func (app *App) routes() http.Handler {
mux := http.NewServeMux()
// dynamic routes
mux.HandleFunc("GET /", app.Index)
mux.HandleFunc("POST /up/search", app.UpSearch)
// serve files from the "static" directory
fs := http.FileServer(http.Dir("assets/static"))
mux.Handle("GET /static/", http.StripPrefix("/", fs))
return mux
}