Files
projectreshoot/server/routes.go

26 lines
553 B
Go

package server
import (
"net/http"
"projectreshoot/handlers"
"projectreshoot/view/page"
)
func addRoutes(
mux *http.ServeMux,
config *Config,
) {
// Static files
mux.Handle("GET /static/", http.StripPrefix("/static/", handlers.HandleStatic()))
// Index page
mux.Handle("GET /", handlers.HandleRoot())
// Static pages
mux.Handle("GET /about", handlers.HandlePage(page.About()))
// Login page and handlers
mux.Handle("GET /login", handlers.HandleLoginPage(config.TrustedHost))
mux.Handle("POST /login", handlers.HandleLoginRequest())
}