feat(http): add imprint url
This commit is contained in:
+13
-4
@@ -3,16 +3,14 @@ package http
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
assets "tomatentum.net/outfit-voting-abi26"
|
||||
"tomatentum.net/outfit-voting-abi26/internal/auth"
|
||||
"tomatentum.net/outfit-voting-abi26/internal/http/vote"
|
||||
)
|
||||
|
||||
var mux *http.ServeMux = http.NewServeMux()
|
||||
|
||||
func Start() error {
|
||||
mux.Handle("/", auth.AuthMiddleware(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
func Start(imprintURL string) error {
|
||||
mux.HandleFunc("/api/auth/logout", auth.LogoutEndpoint)
|
||||
|
||||
mux.HandleFunc("GET /api/vote/locked", vote.VoteLockedEndpoint)
|
||||
@@ -31,6 +29,17 @@ func Start() error {
|
||||
mux.Handle("POST /api/vote", auth.AuthMiddleware(vote.AddVoteEntryEndpoint))
|
||||
mux.Handle("POST /api/vote/bulk", auth.AuthMiddleware(vote.BulkVoteEntryEndpoint))
|
||||
|
||||
mux.HandleFunc("/impressum", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, imprintURL, http.StatusFound)
|
||||
})
|
||||
|
||||
mux.Handle("/", assets.HttpServer())
|
||||
mux.Handle("/admin", auth.AuthMiddleware(assets.ServeIndex))
|
||||
mux.HandleFunc("/result", assets.ServeIndex)
|
||||
mux.HandleFunc("/account", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, auth.IssuerBaseURL(), http.StatusFound)
|
||||
})
|
||||
|
||||
auth.CallbackHandler(mux)
|
||||
return http.ListenAndServe(":4000", corsMiddleware(mux))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user