api/routes/user.js
2018-09-09 18:15:19 +02:00

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
}