mirror of
https://github.com/kaythomas0/noisedash.git
synced 2025-11-12 03:16:20 +00:00
22 lines
469 B
JavaScript
22 lines
469 B
JavaScript
const express = require('express')
|
|
const passport = require('passport')
|
|
const router = express.Router()
|
|
|
|
router.post('/login/password', passport.authenticate('local'), function (req, res, next) {
|
|
return res.send('Authenticated and logged in')
|
|
})
|
|
|
|
router.get('/auth', function (req, res) {
|
|
if (req.user) {
|
|
res.sendStatus(200)
|
|
} else {
|
|
res.sendStatus(401)
|
|
}
|
|
})
|
|
|
|
router.get('/logout', function (req, res, next) {
|
|
req.logout()
|
|
})
|
|
|
|
module.exports = router
|