Merge pull request '🐛 fix 404 on first hit' (#21) from ada/fix-404 into main

Reviewed-on: #21
This commit is contained in:
Ada 2024-02-18 00:14:13 +00:00
commit c188b73a7f

View file

@ -17,7 +17,7 @@ type ServerConfig struct {
} }
// Configure HTTP router // Configure HTTP router
func (config ServerConfig) router(_ http.ResponseWriter, _ *http.Request) { func (config ServerConfig) router() {
WebConfig := plak.WebConfig{ WebConfig := plak.WebConfig{
DB: config.DB, DB: config.DB,
UrlLength: config.UrlLength, UrlLength: config.UrlLength,
@ -45,7 +45,7 @@ func Config(listenAddress string) *http.Server {
func (config ServerConfig) Server() { func (config ServerConfig) Server() {
log.Println("Listening on " + config.HTTPServer.Addr) log.Println("Listening on " + config.HTTPServer.Addr)
http.HandleFunc("/", config.router) config.router()
log.Fatal(config.HTTPServer.ListenAndServe()) log.Fatal(config.HTTPServer.ListenAndServe())
} }