Skip to content

Commit

Permalink
Remove unused file serving
Browse files Browse the repository at this point in the history
  • Loading branch information
aleda145 committed Aug 19, 2022
1 parent 1f3169f commit 22eb6e4
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions backend/pocketbase/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,20 @@ import (

"github.com/labstack/echo/v5"
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/apis"
"github.com/pocketbase/pocketbase/core"
)

func main() {
fmt.Println("Initalizating pocketbase")
app := pocketbase.New()

app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
// serves static files from the provided public dir (if exists)
subFs := echo.MustSubFS(e.Router.Filesystem, "pb_public")
e.Router.GET("/*", apis.StaticDirectoryHandler(subFs, false))

return nil
})
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
e.Router.AddRoute(echo.Route{
Method: http.MethodGet,
Path: "/api/hello",
Handler: func(c echo.Context) error {
return c.String(200, "Hello world!")
},
// Middlewares: []echo.MiddlewareFunc{
// apis.RequireAdminOrUserAuth(),
// },
})

return nil
Expand Down

0 comments on commit 22eb6e4

Please sign in to comment.