From cf5bbc8b98c4208515f8672fb025f247f4fe1457 Mon Sep 17 00:00:00 2001 From: KeziaWahome Date: Thu, 4 Jan 2024 02:23:16 +0200 Subject: [PATCH] Update for Heroku deployment --- api/.env | 0 api/server.js | 7 ++++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 api/.env diff --git a/api/.env b/api/.env new file mode 100644 index 00000000..e69de29b diff --git a/api/server.js b/api/server.js index b3328f90..1aa6bbb3 100644 --- a/api/server.js +++ b/api/server.js @@ -183,6 +183,7 @@ import swaggerUi from 'swagger-ui-express'; import { swaggerSpec } from './swagger.js'; import path from 'path'; +const PORT = process.env.PORT || 4000; const secret = 'secret123'; const app = express(); @@ -337,6 +338,6 @@ app.get('*', (req, res) => { }); - - -app.listen(4000); \ No newline at end of file +app.listen(PORT, () => { + console.log(`Server is running on port ${PORT}`); +}); \ No newline at end of file