Skip to content

Commit

Permalink
Added a new route for server health check
Browse files Browse the repository at this point in the history
  • Loading branch information
alwinsimon committed Jul 23, 2024
1 parent cfa90c1 commit 2514acd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
25 changes: 24 additions & 1 deletion app/controllers/adminController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,30 @@ const userHelpers = require('../../helpers/user-helpers');
require('dotenv').config(); // Module to Load environment variables from .env file


const PLATFORM_NAME = process.env.PLATFORM_NAME || "GetMyDeal"
const PLATFORM_NAME = process.env.PLATFORM_NAME || "GetMyDeal";

/* ============================================= HEALTH STATUS CONTROLLER ============================================= */

const healthStatusGET = (req, res) => {
const currentDate = new Date();
const options = {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric",
timeZone: "UTC",
};
const formattedDate = currentDate.toLocaleString("en-US", options);

res.status(200).json({
status: `${process.env.APPLICATION_NAME} and Systems are Up & Running.`,
dateTime: formattedDate,
});

};

/* ============================================= LOGIN & LOGOUT CONTROLLERS ============================================= */

Expand Down Expand Up @@ -576,6 +598,7 @@ const adminErrorHandlerPageGET = (req,res)=>{

module.exports = {

healthStatusGET,
logInGET,
logInPOST,
logOutPOST,
Expand Down
4 changes: 4 additions & 0 deletions routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const multerUploadBannerImage = multer.uploadBannerImage.single('banner-image');
/*=================================================ADMIN ROUTES=================================================*/


/* ========================HEALTH CHECK ROUTE======================== */

router.get('/health', adminController.healthStatusGET);

/* ========================LOGIN & LOGOUT ROUTES======================== */

router.get('/login', adminController.logInGET);
Expand Down

0 comments on commit 2514acd

Please sign in to comment.