24 lines
505 B
Go
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"))
|
|
}
|