mirror of
https://github.com/kevin-DL/gothstarter.git
synced 2026-01-16 12:04:40 +00:00
initial
This commit is contained in:
27
main.go
Normal file
27
main.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user