diff --git a/index.js b/index.js index d9fa56e..2cf9d4b 100644 --- a/index.js +++ b/index.js @@ -596,6 +596,19 @@ app.get("/api/v1/checkAvailability/:number", (req, res) => { }); }); +app.get("/api/healthcheck", (req, res) => { + // Check ability to connect to database with select * from routes + db.get('SELECT * FROM routes', [], (err, row) => { + if (err) { + console.error('Error checking health:', err); + res.status(500).send('Internal server error'); + return; + } + res.status(200).send('OK'); + }); +}); + + // Query to get a route app.get('/api/v1/route/:apiKey/:ani/:number', (req, res) => { const apiKey = req.params.apiKey;