mirror of
https://github.com/anatolykopyl/registration.git
synced 2026-03-26 12:55:25 +00:00
Status codes
This commit is contained in:
@@ -29,16 +29,16 @@ client.connect()
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
if (req.session.loggedIn) {
|
||||
res.sendFile(__dirname+'/public/personal.html')
|
||||
res.status(200).sendFile(__dirname+'/public/personal.html')
|
||||
} else {
|
||||
res.sendFile(__dirname+'/public/auth.html')
|
||||
res.status(200).sendFile(__dirname+'/public/auth.html')
|
||||
}
|
||||
})
|
||||
|
||||
app.get('/get-users', async (_, res) => {
|
||||
try {
|
||||
const users = await client.db('reg_example').collection('users').find().toArray()
|
||||
res.send(users)
|
||||
res.status(200).send(users)
|
||||
} catch (e) {
|
||||
console.log("Error: " + e)
|
||||
res.status(500).send()
|
||||
|
||||
Reference in New Issue
Block a user