Files
go_blog/routers/router.go
2025-04-01 17:59:10 +08:00

24 lines
505 B
Go

package routers // Add the package declaration at the top
import (
"net/http"
"github.com/gin-gonic/gin"
)
func RegisterRoutes(r *gin.Engine) {
// Frontend routes (dynamic themes)
r.GET("/", handlers.Home)
r.GET("/post/:id", handlers.ShowPost)
// Admin panel
admin := r.Group("/admin", middleware.AuthRequired())
{
admin.GET("/themes", handlers.ListThemes)
admin.POST("/themes/switch", handlers.SwitchTheme)
}
// Static files for themes
r.StaticFS("/themes", http.Dir("web/themes"))
}