-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
31 lines (23 loc) · 587 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"embed"
"log"
"github.com/labstack/echo/v5"
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/core"
)
//go:embed all:frontend/build
var frontend embed.FS
var distDirFS = echo.MustSubFS(frontend, "frontend/build")
func main() {
app := pocketbase.New()
// Integrate Echo router with PocketBase
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
e.Router.Any("/*", echo.StaticDirectoryHandler(distDirFS, false))
return nil
})
// Start the PocketBase application
if err := app.Start(); err != nil {
log.Fatal(err)
}
}