htmgo/htmgo-site/pages/setup.go
2024-09-20 11:45:23 -05:00

14 lines
344 B
Go

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)
})
}
}