diff --git a/app.js b/app.js index 04fc8b8..fa14571 100644 --- a/app.js +++ b/app.js @@ -3,12 +3,19 @@ const path = require('path'); const morgan = require('morgan'); const helmet = require('helmet'); const compression = require('compression'); -const app = express(); -// const movieRouter = require('./routes/movieRoutes'); +const dotenv = require('dotenv'); + const viewRouter = require('./routes/viewRoutes'); const globalErrorHandler = require('./controllers/errorControllers'); const { AppError } = require('./utils/errorUtils'); +const app = express(); + +//---------------------------------------------------------------------------// +// LOADING CONFIG FILE VARIABLES +//---------------------------------------------------------------------------// +dotenv.config({ path: './config.env' }); // loading .env variables + //-------------------------------------------------------------------------// // GLOBAL MIDDLEWARES //-------------------------------------------------------------------------// diff --git a/server.js b/server.js index 2af9f46..317ef0c 100644 --- a/server.js +++ b/server.js @@ -1,4 +1,3 @@ -const dotenv = require('dotenv'); const app = require('./app'); //---------------------------------------------------------------------------// @@ -16,11 +15,6 @@ process.on('unhandledRejection', err => { server.close(() => process.exit(1)); // shutting the system down gracefully }); -//---------------------------------------------------------------------------// -// LOADING CONFIG FILE VARIABLES -//---------------------------------------------------------------------------// -dotenv.config({ path: './config.env' }); // loading .env variables - //---------------------------------------------------------------------------// // STARTING SERVER //---------------------------------------------------------------------------//