You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write content for docs/site/migration/express-middleware.md, explain how to modify a LB4 app with a mounted LB3 app to share the same Express middleware.
Initial setup:
lb4-app
- lb3-app
- Express middleware
The idea is to create a new top-level Express app, where we can mount the middleware to get it executed for requests handled by both LB3 and LB4 routes.
The idea is to create a new top-level Express app, where we can mount the middleware to get it executed for requests handled by both LB3 and LB4 routes.
In the migration guide, we need to describe how to apply the steps outlines in "Creating an Express Application with LoopBack REST API" to an application created by following the steps in Mounting a LoopBack 3 application.
Note that in LB3, we are using declarative approach to middleware registration (see server/middleware.json). In Express+LB4+LB3 scenario, middleware is registered programmatically from JS/TS code.
In case anyone needs this, the concept of interceptors solved this for me. to simulate a global app.use like in express I made a global interceptor. For middlewares scoped to class methods(controllers) create local interceptors and decorate your controller methods with the @intercept decorator function. See an example loopback-next helmet middleware here
This is a follow-up for #3718 and #3922.
Write content for
docs/site/migration/express-middleware.md
, explain how to modify a LB4 app with a mounted LB3 app to share the same Express middleware.Initial setup:
The idea is to create a new top-level Express app, where we can mount the middleware to get it executed for requests handled by both LB3 and LB4 routes.
Acceptance criteria
The text was updated successfully, but these errors were encountered: