1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/routes/admin-api/user.js
2020-02-20 08:34:07 +01:00

28 lines
530 B
JavaScript

'use strict';
const { Router } = require('express');
exports.router = function() {
const router = Router();
router.get('/', (req, res) => {
if (req.user) {
return res
.status(200)
.json(req.user)
.end();
} else {
return res.status(404).end();
}
});
router.get('/logout', (req, res) => {
if (req.session) {
req.session = null;
}
res.redirect('/');
});
return router;
};