get users

This commit is contained in:
2018-06-01 13:40:12 +03:00
parent 9c7907f1e8
commit 21477e3ef1
3 changed files with 31 additions and 1 deletions

View File

@@ -11,6 +11,16 @@ const auth = require('./auth');
const { NotFoundError } = require('../errors');
router.get(
'/user',
auth.required,
asyncHelper(async (req, res) => {
const { id } = req.user;
const user = await User.findById(id).exec();
res.json({ success: true, data: user.toJson() });
}),
);
router.post(
'/',
asyncHelper(async (req, res) => {