From 746cb1639185df615fbdb470e3a0a8f46a41746c Mon Sep 17 00:00:00 2001 From: Pin Lin Date: Fri, 3 Apr 2020 00:40:42 +0800 Subject: [PATCH] Change port by env --- src/app.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index 111c8d0..8baa9ff 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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}!`); });