Use generated interface

This commit is contained in:
2025-01-13 11:26:18 +01:00
parent c3563878b7
commit c7cccf2ec1
5 changed files with 23 additions and 15 deletions

View File

@ -1,6 +1,7 @@
package main
import (
api "code.dlmw.ch/dlmw/qv/internal"
"code.dlmw.ch/dlmw/qv/internal/models"
"code.dlmw.ch/dlmw/qv/ui"
"github.com/justinas/alice"
@ -21,8 +22,10 @@ func (app *application) routes() http.Handler {
mux.Handle("GET /static/", http.FileServerFS(ui.Files))
mux.HandleFunc("GET /election/create", app.createElectionPage)
mux.HandleFunc("POST /election", app.createElection)
mux.HandleFunc("POST /election/{id}/votes", app.createVotes)
api.HandlerWithOptions(app, api.StdHTTPServerOptions{
BaseRouter: mux,
ErrorHandlerFunc: app.badRequestError,
})
standard := alice.New(app.recoverPanic, app.logRequest)
return standard.Then(mux)