From 0cf42870639d654a30011ddf4fb87be9e0782e7b Mon Sep 17 00:00:00 2001 From: Kar l5 Date: Sat, 27 Jul 2024 20:23:25 +0530 Subject: [PATCH] host --- src/config/constants.js | 1 + src/index.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config/constants.js b/src/config/constants.js index b84e8fb..59ac99d 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -1 +1,2 @@ export const PORT = 4400; +export const HOST = '0.0.0.0'; diff --git a/src/index.js b/src/index.js index 28883f0..ad3c8a3 100644 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,7 @@ import helmet from "helmet"; import compression from "compression"; import fileUpload from "express-fileupload"; import routes from "./routes/index"; -import {PORT} from "./config/constants"; +import {PORT,HOST} from "./config/constants"; import { accessTokenMiddleWare } from "./utils/helpers"; var app = express(); @@ -86,8 +86,8 @@ app.use(function (err, req, res) { }); }); -app.listen(process.env.PORT || PORT, () => - console.log(`App listening on http://localhost:${process.env.PORT || PORT}`) +app.listen(process.env.PORT || PORT,process.env.HOST || HOST, () => + console.log(`App listening on http://${process.env.HOST || HOST}:${process.env.PORT || PORT}`) ); export default app;