Skip to content

Commit

Permalink
solve issue #8 : Update app.js with environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mathanraj0601 committed Jan 21, 2024
1 parent bef664e commit 63da219
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ app.use(Routes);
/**
* connect to db then start server
// */
const environment = process.env.ENVIRONMENT || "development";
dbConnect(() => {
if (process.env.ENVIRONMENT && process.env.ENVIRONMENT !== "test") {
if (environment && environment !== "test") {
console.log(environment, "env");
app.listen(process.env.PORT, () => {
console.log(`Server is running on port ${process.env.PORT}`);
});
Expand Down

0 comments on commit 63da219

Please # to comment.