This commit is contained in:
anthdm
2024-04-24 19:52:05 +02:00
commit af9c83cbd0
31 changed files with 1515 additions and 0 deletions

27
main.go Normal file
View File

@@ -0,0 +1,27 @@
package main
import (
"gothstarter/handlers"
"log"
"log/slog"
"net/http"
"os"
"github.com/go-chi/chi/v5"
"github.com/joho/godotenv"
)
func main() {
if err := godotenv.Load(); err != nil {
log.Fatal(err)
}
router := chi.NewMux()
router.Handle("/*", public())
router.Get("/", handlers.Make(handlers.HandleHome))
router.Get("/login", handlers.Make(handlers.HandleLoginIndex))
listenAddr := os.Getenv("LISTEN_ADDR")
slog.Info("HTTP server started", "listenAddr", listenAddr)
http.ListenAndServe(listenAddr, router)
}