Files
qv/cmd/web/routes.go

24 lines
468 B
Go
Raw Normal View History

2024-12-27 18:03:46 +01:00
package main
import (
2024-12-31 15:29:19 +01:00
"code.dlmw.ch/dlmw/qv/internal/models"
2024-12-27 18:03:46 +01:00
"github.com/justinas/alice"
2024-12-31 15:29:19 +01:00
"log/slog"
2024-12-27 18:03:46 +01:00
"net/http"
)
2024-12-31 15:29:19 +01:00
type application struct {
logger *slog.Logger
elections models.ElectionModelInterface
voters models.VoterModelInterface
}
2024-12-27 18:03:46 +01:00
func (app *application) routes() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("POST /election", app.createElection)
standard := alice.New(app.recoverPanic, app.logRequest)
return standard.Then(mux)
}