user-id-from-me.js 243 B

123456789
  1. module.exports = (req, res, next) => {
  2. if (req.params.user_id === 'me' && res.locals.access) {
  3. req.params.user_id = res.locals.access.token.get('attrs').id;
  4. } else {
  5. req.params.user_id = parseInt(req.params.user_id, 10);
  6. }
  7. next();
  8. };