22 lines
457 B
JavaScript
22 lines
457 B
JavaScript
const express = require('express')
|
|
const router = express.Router()
|
|
|
|
module.exports = function (passport) {
|
|
router.route('/api/login/')
|
|
.post(
|
|
passport.authenticate(['basic-auth']),
|
|
function (req, res) {
|
|
res.status(200).send(req.user)
|
|
}
|
|
)
|
|
|
|
router.route('/api/me/')
|
|
.get(
|
|
passport.authenticate(['basic-auth']),
|
|
function (req, res) {
|
|
res.status(200).send(req.user)
|
|
}
|
|
)
|
|
|
|
return router
|
|
}
|