Skip to content

Commit

Permalink
feat: added status basic endpoint (chrisleekr#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Marchioro authored Oct 6, 2021
1 parent 04b334a commit 06eb81b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/frontend/webserver/handlers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ const { handleGridTradeArchiveGet } = require('./grid-trade-archive-get');
const { handleGridTradeArchiveDelete } = require('./grid-trade-archive-delete');
const { handleClosedTradesSetPeriod } = require('./closed-trades-set-period');
const { handle404 } = require('./404');
const { handleStatus } = require('./status');

const setHandlers = async (logger, app, { loginLimiter }) => {
await handleAuth(logger, app, { loginLimiter });
await handleGridTradeArchiveGet(logger, app);
await handleGridTradeArchiveDelete(logger, app);
await handleClosedTradesSetPeriod(logger, app);
await handleStatus(logger, app);
await handle404(logger, app);
};

Expand Down
24 changes: 24 additions & 0 deletions app/frontend/webserver/handlers/status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const requestIp = require('request-ip');

const handleStatus = async (funcLogger, app) => {
const logger = funcLogger.child({ endpoint: '/status' });

app.route('/status').get(async (req, res) => {
const clientIp = requestIp.getClientIp(req);

logger.info(
{
clientIp
},
'handle status monitoring endpoint'
);

return res.send({
success: true,
status: 200,
message: 'OK'
});
});
};

module.exports = { handleStatus };

0 comments on commit 06eb81b

Please sign in to comment.