1234567891011121314151617181920212223242526272829303132333435 |
- package fiber
- import (
- "github.com/gofiber/fiber/v2"
- "git.dmitriygnatenko.ru/dima/dmitriygnatenko-v2/internal/services/handler"
- )
- func initPublicHandlers(app *fiber.App, sp ServiceProvider) {
- mainPageHandler := handler.MainPageHandler(
- sp.CacheService(),
- sp.ArticleRepository(),
- )
- app.Get("/:lang<regex(^en$)>", mainPageHandler)
- app.Get("/", mainPageHandler)
- tagPageHandler := handler.TagHandler(
- sp.CacheService(),
- sp.ArticleRepository(),
- sp.TagRepository(),
- )
- app.Get("/:lang<regex(^en$)/tag/:tag>", tagPageHandler)
- app.Get("/tag/:tag", tagPageHandler)
- articlePageHandler := handler.ArticleHandler(
- sp.CacheService(),
- sp.ArticleRepository(),
- sp.TagRepository(),
- )
- app.Get("/:lang<regex(^en$)/article/:article", articlePageHandler)
- app.Get("/article/:article", articlePageHandler)
- }
|