Skip to content

Commit

Permalink
Added GET /health endpoint for lottery API server (CMW-1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodymyr-Kuchinskyi committed Aug 28, 2024
1 parent a02f0b8 commit 48f13b9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion server/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,20 @@ async function main() {
res.json({ data: rounds, total });
});

app.get('/proxy-wasm', async (req: Request, res: Response) => {
app.get('/proxy-wasm', async (_: Request, res: Response) => {
fs.createReadStream(path.resolve(__dirname, `./resources/proxy_caller.wasm`)).pipe(res);
});

app.get('/health', async (_: Request, res: Response) => {
try {
await AppDataSource.query('SELECT 1');

return res.status(200).json({ status: 'UP' });
} catch (error) {
return res.status(500).json({ status: 'DOWN', error: error.message });
}
});

server.listen(config.httpPort, () => console.log(`Server running on http://localhost:${config.httpPort}`));
}

Expand Down

0 comments on commit 48f13b9

Please sign in to comment.