2025-04-01 17:59:10 +08:00
|
|
|
package routers // Add the package declaration at the top
|
|
|
|
|
|
|
|
|
|
import (
|
2025-04-09 16:56:05 +08:00
|
|
|
"go_blog/controllers"
|
2025-04-01 17:59:10 +08:00
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func RegisterRoutes(r *gin.Engine) {
|
|
|
|
|
// Frontend routes (dynamic themes)
|
2025-04-09 16:56:05 +08:00
|
|
|
r.GET("/", controllers.Home)
|
|
|
|
|
r.GET("/post/:id", controllers.ShowPost)
|
2025-04-01 17:59:10 +08:00
|
|
|
|
2025-04-09 16:56:05 +08:00
|
|
|
// // Admin panel
|
|
|
|
|
// admin := r.Group("/admin", middleware.AuthRequired())
|
|
|
|
|
// {
|
|
|
|
|
// admin.GET("/themes", controllers.ListThemes)
|
|
|
|
|
// admin.POST("/themes/switch", controllers.SwitchTheme)
|
|
|
|
|
// }
|
2025-04-01 17:59:10 +08:00
|
|
|
|
|
|
|
|
// Static files for themes
|
|
|
|
|
r.StaticFS("/themes", http.Dir("web/themes"))
|
|
|
|
|
}
|