Add /api/health endpoint to check server status 馃彞
File: server/index.js
No way to check if the backend is running
without hitting a real route 馃拃 fr!!
Fix: add health check route:
app.get('/api/health', (req, res) => {
res.json({
status: 'ok',
uptime: process.uptime(),
timestamp: new Date().toISOString(),
mongodb: mongoose.connection.readyState === 1
? 'connected' : 'disconnected'
})
})
~8 lines! Super useful for deployment!!
Vercel/Render can ping this to check
if server is alive 馃敟
No frontend changes needed 馃幆
Add /api/health endpoint to check server status 馃彞
File: server/index.js
No way to check if the backend is running
without hitting a real route 馃拃 fr!!
Fix: add health check route:
app.get('/api/health', (req, res) => {
res.json({
status: 'ok',
uptime: process.uptime(),
timestamp: new Date().toISOString(),
mongodb: mongoose.connection.readyState === 1
? 'connected' : 'disconnected'
})
})
~8 lines! Super useful for deployment!!
Vercel/Render can ping this to check
if server is alive 馃敟
No frontend changes needed 馃幆