Skip to content

Instantly share code, notes, and snippets.

@alanhoff
Created July 26, 2013 11:24
Show Gist options
  • Save alanhoff/6088166 to your computer and use it in GitHub Desktop.
Save alanhoff/6088166 to your computer and use it in GitHub Desktop.
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