Skip to content

Commit

Permalink
updated health check route
Browse files Browse the repository at this point in the history
  • Loading branch information
marythedev committed Nov 27, 2023
1 parent e950cf6 commit 022dd0c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { version, author } = require('../../package.json');
const { authenticate } = require('../auth');
const { createSuccessResponse } = require('../response');
const router = express.Router();
const { hostname } = require('os');

//Expose all of API routes on /v1/* to include an API version.
router.use(`/v1`, authenticate(), require('./api'));
Expand All @@ -12,14 +13,14 @@ router.get('/', (req, res) => {
//makes sure the response isn't cached
//https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#controlling_caching
res.setHeader('Cache-Control', 'no-cache');

let data = {
author,
githubUrl: 'https://github.com/marythedev/fragments',
version,
};

res.status(200).json(createSuccessResponse(data));
res.status(200).json(
createSuccessResponse({
author,
githubUrl: 'https://github.com/marythedev/fragments',
version,
hostname: hostname(),
})
);
});

module.exports = router;

0 comments on commit 022dd0c

Please sign in to comment.