Skip to content

Instantly share code, notes, and snippets.

@gajus
Created March 15, 2015 18:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gajus/5bcd3c7ec5ddcaf53893 to your computer and use it in GitHub Desktop.
Save gajus/5bcd3c7ec5ddcaf53893 to your computer and use it in GitHub Desktop.
authenticate = function (token, callback) {
var connection = mysql.createConnection();
connection.connect(function () {
db.query('SELECT `id` FROM `user` WHERE `token` = ?', [token], function (err, rows) {
connection.end();
callback(rows[0]);
})
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment