Serve pb_public as a static asset
This commit is contained in:
parent
d43103570e
commit
df6369b9ad
1 changed files with 8 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
|
|
@ -29,10 +30,17 @@ type Project struct {
|
|||
|
||||
func main() {
|
||||
app := pocketbase.New()
|
||||
|
||||
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{
|
||||
Automigrate: false,
|
||||
})
|
||||
|
||||
app.OnServe().BindFunc(func(se *core.ServeEvent) error {
|
||||
se.Router.GET("/{path...}", apis.Static(os.DirFS("pb_public"), false))
|
||||
|
||||
return se.Next()
|
||||
})
|
||||
|
||||
app.OnServe().BindFunc(func(e *core.ServeEvent) error {
|
||||
e.Router.GET("/api/hours/{organisation}/{year}/{month}", func(c *core.RequestEvent) error {
|
||||
year := c.Request.PathValue("year")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue