Skip to content

Commit

Permalink
chore: add health endpoint (#1109)
Browse files Browse the repository at this point in the history
* chore: add health endpoint

* only in dev

* pr comments
  • Loading branch information
chakra-guy authored Oct 31, 2024
1 parent b901dde commit d607bb7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/sdk-socket-server-next/src/analytics-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,18 @@ const analytics = new Analytics(
},
);

app.get('/', (_req, res) => {
app.get('/', (req, res) => {
if (process.env.NODE_ENV === 'development') {
logger.info(`health check from`, {
'x-forwarded-for': req.headers['x-forwarded-for'],
'cf-connecting-ip': req.headers['cf-connecting-ip'],
});
}

res.json({ success: true });
});


// Redirect /debug to /evt for backwards compatibility
app.post('/debug', (req, _res, next) => {
req.url = '/evt'; // Redirect to /evt
Expand Down

0 comments on commit d607bb7

Please sign in to comment.