feat(node): read the port from env
This commit is contained in:
parent
1bd0ab2a80
commit
6d661cf633
@ -11,7 +11,7 @@ app.get('/', (req, res) => {
|
|||||||
res.send(`Welcome to <%= name %>!`);
|
res.send(`Welcome to <%= name %>!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
const port = 3333;
|
const port = process.env.port || 3333;
|
||||||
app.listen(port, (err) => {
|
app.listen(port, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
@ -9,8 +9,9 @@ import { AppModule } from './app/app.module';
|
|||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
await app.listen(3333, () => {
|
const port = process.env.port || 3333;
|
||||||
console.log('Listening at http://localhost:3333');
|
await app.listen(port, () => {
|
||||||
|
console.log(`Listening at http://localhost:${port}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user