Add a little page if you try to GET your client

This commit is contained in:
Christopher Cookman 2025-06-03 13:26:56 -06:00
parent 898e23b871
commit ecd29073e9

View file

@ -67,6 +67,19 @@ app.post('/:cid/:hook_id/:hook_token', (req, res) => {
res.status(200).json({ status: 'ok' });
});
app.get('/:cid', (req, res) => {
const cid = req.params.cid;
if (!cid) {
console.log(`Invalid request: cid is required`.red);
return res.status(400).json({ error: 'cid is required' });
}
if (!cidsInUse.has(cid)) {
console.log(`No client connected with cid: ${cid}`.red);
return res.status(504).json({ error: 'no client connected' });
}
res.status(200).json({ status: 'ok', message: 'Client is connected and ready to receive your webhooks!' });
});
const PORT = process.env.SERVER_PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is listening on port ${PORT}`.green);