const UserRepository = require("../database").Repositories.Users; class Authorization { constructor() { } _parseToken(req, res, next) { const token = req.query.token; if(!token)return next(); console.log("Token parsing : " + token); UserRepository.getUser(token). then((user) => { req.user = user; next(); }). catch((err) => { next(err); }); } getTokenParser() { return this._parseToken; } } module.exports = new Authorization();