mirror of
https://github.com/kevin-DL/gothstarter.git
synced 2026-01-11 10:04:34 +00:00
28 lines
536 B
Go
28 lines
536 B
Go
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)
|
|
}
|