Change port by env

This commit is contained in:
2020-04-03 00:40:42 +08:00
parent 6347ad4c2b
commit 746cb16391

View File

@ -1,6 +1,8 @@
import express from 'express';
import { getLocationOfTarget } from './app.service';
const port = Number(process.env.PORT) || 3000;
const app = express();
app.get('/*', async (req, res) => {
@ -15,6 +17,6 @@ app.get('/*', async (req, res) => {
}
});
app.listen(3000, () => {
console.log('Now listening on port 3000!');
app.listen(port, () => {
console.log(`Now listening on port ${port}!`);
});