1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-27 08:27:06 +02:00

[#2914] register the eagerRequestDataCache middleware only for the api grroup to avoid conflicts with custom routes

This commit is contained in:
Gani Georgiev
2023-07-14 11:55:29 +03:00
parent c3844250e8
commit f0bcffec8b
2 changed files with 66 additions and 46 deletions

View File

@@ -104,7 +104,7 @@ func InitApi(app core.App) (*echo.Echo, error) {
bindStaticAdminUI(app, e)
// default routes
api := e.Group("/api")
api := e.Group("/api", eagerRequestDataCache(app))
bindSettingsApi(app, api)
bindAdminApi(app, api)
bindCollectionApi(app, api)
@@ -126,10 +126,6 @@ func InitApi(app core.App) (*echo.Echo, error) {
return nil, err
}
// note: it is after the OnBeforeServe hook to ensure that the implicit
// cache is after any user custom defined middlewares
e.Use(eagerRequestDataCache(app))
// catch all any route
api.Any("/*", func(c echo.Context) error {
return echo.ErrNotFound