question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using the express app

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ricardosaracinocommented, Jun 7, 2019

Question i was able to do this previously… is there a recommended way to do this now?

app.set('trust proxy', 1);

0reactions
lock[bot]commented, Oct 23, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Express.js | app.use() Function - GeeksforGeeks
The app.use() function is used to mount the specified middleware function(s) at the path which is being specified. It is mostly used to...
Read more >
Hello world example - Express.js
This app starts a server and listens on port 3000 for connections. The app responds with “Hello World!” for requests to the root...
Read more >
node.js - NodeJS / Express: what is "app.use"? - Stack Overflow
app.use is a way to register middleware or chain of middlewares (or multiple middlewares) before executing any end route logic or intermediary ...
Read more >
The `app.use()` Function in Express - Mastering JS
In Express, everything is middleware. Internally, an Express app has a middleware stack, and calling use() adds a new layer to the stack....
Read more >
Express.js – app.use() Method - Tutorialspoint
The app.use() method mounts or puts the specified middleware functions at the specified path. This middleware function will be executed only ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found