feat: complete go rewrite

This commit is contained in:
Blake Ridgway
2025-11-12 19:18:29 -06:00
parent 9d78f1fdb4
commit cb3293c7b0
26 changed files with 1286 additions and 531 deletions

37
cmd/admin-panel/main.go Normal file
View File

@@ -0,0 +1,37 @@
package main
import (
"log"
"github.com/rideaware/admin-panel/internal/config"
"github.com/rideaware/admin-panel/internal/database"
"github.com/rideaware/admin-panel/internal/handlers"
"github.com/rideaware/admin-panel/internal/middleware"
"github.com/gin-gonic/gin"
)
func main() {
cfg := config.Load()
middleware.Init()
database.Init(cfg)
defer database.Close()
router := gin.Default()
router.LoadHTMLGlob("web/templates/*.html")
router.Static("/static", "web/static")
router.GET("/login", handlers.LoginGet)
router.POST("/login", handlers.LoginPost)
router.GET("/logout", handlers.Logout)
protected := router.Group("/")
protected.Use(middleware.Auth())
protected.GET("/", handlers.IndexGet)
protected.GET("/send_update", handlers.SendUpdateGet)
protected.POST("/send_update", handlers.SendUpdatePost)
log.Printf("Server running on port %s", cfg.Port)
router.Run(":" + cfg.Port)
}