clean pb examples
This commit is contained in:
parent
ba77f04e30
commit
a5517264a7
28
pb/pb.go
28
pb/pb.go
@ -1,36 +1,18 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v5"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/charmbracelet/log"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
)
|
||||
|
||||
func Run() {
|
||||
app := pocketbase.New()
|
||||
|
||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
// add new "GET /hello" route to the app router (echo)
|
||||
e.Router.AddRoute(echo.Route{
|
||||
Method: http.MethodGet,
|
||||
Path: "/hello",
|
||||
Handler: func(c echo.Context) error {
|
||||
return c.String(200, "Hello world!")
|
||||
},
|
||||
Middlewares: []echo.MiddlewareFunc{
|
||||
apis.ActivityLogger(app),
|
||||
},
|
||||
})
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
// Start the PocketBase server in a goroutine.
|
||||
func() {
|
||||
if err := app.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
BIN
pb_data/logs.db
BIN
pb_data/logs.db
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user