Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function generateTokenBehavior(data) {
- let username, password;
- // checks for authorisation headers
- if (_.has(data, 'headers.authorization')) {
- username = auth(data).name;
- password = auth(data).pass;
- } ...
- ... operations on username and password ...
- responseData.status = 200;
- responseData.data = {meta:{token}};
- return responseData;
- }
- function generateToken(req, res, next) {
- const responseData = generateTokenBehavior(req);
- return res.status(responseData.status).json(responseData.data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement