Reputation: 693
How can I access the express app instance within a LoopBack 4 application to add a middlware such as helmet or compression via app.use()
?
Upvotes: 3
Views: 924
Reputation: 1585
Since the previous answer, LoopBack 4 has provided support for Express.js middleware support alongside the existing LoopBack 4 middleware:
This includes additional features that enable integration with the Context for dependency injection, wrapping the middleware in a factory function for dynamic configuration, and using it as an interceptor.
Upvotes: 1
Reputation: 10785
LoopBack 4 does not have a first-class support for Express middleware yet, please join the discussion in the following GitHub issue:
Our current recommendation is to create a top-level Express application (where you can mount middleware like helmet
) and then mount the LoopBack4 application as a sub-component. You can learn more in the following tutorial:
Upvotes: 1