Last active
May 30, 2018 01:14
-
-
Save sean3z/81eaf27b7f3de3127fa75a87433947de to your computer and use it in GitHub Desktop.
Restify JWT example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
exports.authenticate = (username, password) => { | |
return Promise.resolve({ uid: 1, name: 'Sean', admin: false }); | |
}; | |
/* | |
exports.authenticate = (username, password) => { | |
return new Promise((resolve, reject) => { | |
db.findOne({username, password}, (err, data) => { | |
if (err) return reject(err); | |
resolve(data); // {uid: 1, name: Sean, admin: false} | |
}); | |
}); | |
}; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment