Created
July 26, 2013 11:24
-
-
Save alanhoff/6088166 to your computer and use it in GitHub Desktop.
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
var price = -1; | |
var userId = 'some user provided value'; | |
var sql = 'SELECT max(price) FROM users WHERE id = ' + connection.escape(userId); | |
server = http.createServer(function (request, response) { | |
handler(request); //response depend on price | |
}); | |
connection.query(sql, function(err, results) { | |
price = results.price; | |
server.listen(8012); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment