api/routes/user.js

23 lines
457 B
JavaScript
Raw Normal View History

2018-09-09 18:15:19 +02:00
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
}