Updated to BunRouter
This commit is contained in:
@ -1,25 +1,16 @@
|
||||
package pages
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/uptrace/bunrouter"
|
||||
"goth.stack/lib"
|
||||
)
|
||||
|
||||
func SSEDemo(c echo.Context) error {
|
||||
templates := []string{
|
||||
"./pages/templates/layouts/base.html",
|
||||
"./pages/templates/partials/header.html",
|
||||
"./pages/templates/partials/navitems.html",
|
||||
"./pages/templates/ssedemo.html",
|
||||
}
|
||||
func SSEDemo(w http.ResponseWriter, req bunrouter.Request) error {
|
||||
// Specify the partials used by this page
|
||||
partials := []string{"header", "navitems"}
|
||||
|
||||
ts, err := template.ParseFiles(templates...)
|
||||
if err != nil {
|
||||
log.Print(err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
return ts.ExecuteTemplate(c.Response().Writer, "base", nil)
|
||||
// Render the template
|
||||
return lib.RenderTemplate(w, "base", partials, nil)
|
||||
}
|
||||
|
Reference in New Issue
Block a user