htmgo/htmgo-site/pages/setup.go

15 lines
344 B
Go
Raw Normal View History

2024-09-20 16:45:23 +00:00
package pages
import (
"github.com/labstack/echo/v4"
"htmgo-site/internal/dirwalk"
)
func RegisterMarkdown(app *echo.Echo, dir string, handler func(ctx echo.Context, path string) error) {
for _, page := range dirwalk.WalkPages(dir) {
app.GET(page.RoutePath, func(ctx echo.Context) error {
return handler(ctx, page.FilePath)
})
}
}