This file contains hidden or 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
function home() { | |
db.query("SELECT * FROM `posts` ORDER BY `time` DESC LIMIT 10", function(err, rows){ | |
render('home', { posts: rows[0] }, function(err, result){ | |
response.end(result); | |
}); | |
}); | |
} | |
function post(id) { | |
db.query("SELECT * FROM `posts` WHERE `link` = " + db.escape(id)), function(err, rows){ |
This file contains hidden or 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
/** | |
* Example structure for nodeunit tests with nested groups and setup/teardown | |
* functions. Run | nodeunit nodeunit_example.js | to see a printout of | |
* function names in the order that they are called. There aren't any actual | |
* tests here. | |
*/ | |
process.env.NODE_ENV = 'test'; | |
var testCase = require('nodeunit').testCase; |