Skip to content

Commit

Permalink
chore: update guestbook handler to use BindFunc for middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
blackfyre committed Feb 6, 2025
1 parent b50acdc commit dc079d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions handlers/guestbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import (
// for displaying and adding messages to the guestbook.
func registerGuestbookHandlers(app *pocketbase.PocketBase) {

app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
app.OnServe().BindFunc(func(e *core.ServeEvent) error {

e.Router.GET("/guestbook", func(c *core.RequestEvent) error {
return guestbook.EntriesHandler(app, c)
})

e.Router.GET("/guestbook/add", func(c *core.RequestEvent) error {
return guestbook.StoreEntryViewHandler(app, c)
}, utils.IsHtmxRequestMiddleware)
}).BindFunc(utils.IsHtmxRequestMiddleware)

e.Router.POST("/guestbook/add", func(c *core.RequestEvent) error {
return guestbook.StoreEntryHandler(app, c)
}, utils.IsHtmxRequestMiddleware)
}).BindFunc(utils.IsHtmxRequestMiddleware)

return nil

Expand Down

0 comments on commit dc079d1

Please sign in to comment.