Using the express app
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[ x ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
The INestApplication
provides an interface for .set()
which calls the this.express.set()
in the nest-application
. But there’s no getter method for the item you’ve set. The get()
method provided in the INestApplication
is from the ApplicationContext
already not from express instance.
Expected behavior
Expected is to get the value set from the .set
method which is from the express. Also, is it possible to get the express instance created? As I can see from the source, it is not providing any methods to retrieve the created express instance. Why can’t we retrieve it?
Minimal reproduction of the problem with instructions
const nestApp = await NestFactory.create(AppModule); nestApp.set(‘port’, process.env.PORT || 3000); nestApp.get(‘port’) // returns null
What is the motivation / use case for changing the behavior?
An ability or flexibility for the developers to have an instance of express. With that, we can do things like the one above or another one is to send html file on startup.
Environment
Nest version: X.Y.Z
4.6.6
For Tooling issues:
- Node version: 8.10.0
- Platform: Windows
Others:
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
Question i was able to do this previously… is there a recommended way to do this now?
app.set('trust proxy', 1);
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.