mirror of
https://github.com/kaythomas0/noisedash.git
synced 2025-11-14 12:18:01 +00:00
Add setup endpoint
This commit is contained in:
@@ -40,4 +40,19 @@ router.get('/logout', (req, res) => {
|
||||
res.sendStatus(200)
|
||||
})
|
||||
|
||||
router.get('/setup', (req, res) => {
|
||||
db.get('SELECT COUNT(*) as count FROM users', (err, row) => {
|
||||
if (err) {
|
||||
logger.error(err)
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
|
||||
if (row.count === 0) {
|
||||
return res.json({ setup: true })
|
||||
} else {
|
||||
return res.json({ setup: false })
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
|
||||
Reference in New Issue
Block a user