Static files handling

This commit is contained in:
Simon Martens
2025-02-11 21:35:40 +01:00
parent 0c8cd35577
commit 71dcf9bf5e
9 changed files with 50 additions and 107 deletions

View File

@@ -2,6 +2,7 @@ package pages
import (
"net/http"
"strings"
"github.com/Theodor-Springmann-Stiftung/musenalm/app"
"github.com/Theodor-Springmann-Stiftung/musenalm/pagemodels"
@@ -33,7 +34,12 @@ func (p *IndexPage) Down(app core.App) error {
func (p *IndexPage) Setup(router *router.Router[*core.RequestEvent], app core.App, engine *templating.Engine) error {
router.GET("/{$}", func(e *core.RequestEvent) error {
return e.String(http.StatusOK, "Hello, World!")
var builder strings.Builder
err := engine.Render(&builder, "/", nil)
if err != nil {
return err
}
return e.HTML(http.StatusOK, builder.String())
})
return nil
}