aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-05-06 18:46:59 +0200
committerMateja <mail@matejamaric.com>2021-05-06 18:46:59 +0200
commite49326610cb7843c8d905fcb04e57eeaed9d3cad (patch)
treeb1dcbb0adf6d2e8052eaddf55367612e25daf3d6
parent7a0d256d2fabd2f1d583cea6ab0d64dcec12e45a (diff)
downloadnode-playground-e49326610cb7843c8d905fcb04e57eeaed9d3cad.tar.gz
node-playground-e49326610cb7843c8d905fcb04e57eeaed9d3cad.zip
Use PORT environment variable.
-rw-r--r--.env.example1
-rw-r--r--index.js2
2 files changed, 2 insertions, 1 deletions
diff --git a/.env.example b/.env.example
index 980afd3..ca2f89b 100644
--- a/.env.example
+++ b/.env.example
@@ -1,2 +1,3 @@
+PORT=8080
DB_CONN=mongodb://localhost/playground_db
APP_SECRET=replace-this
diff --git a/index.js b/index.js
index 4a55a0f..2d4f1a2 100644
--- a/index.js
+++ b/index.js
@@ -36,4 +36,4 @@ app.use(express.urlencoded({extended: false}));
app.use('/', webRoutes);
-app.listen(8080, () => console.log('Server started on port 8080.'));
+app.listen(process.env.PORT, () => console.log(`Server started on port ${process.env.PORT}.`));