node test
This commit is contained in:
parent
95c092763d
commit
95798131a5
3 changed files with 25 additions and 0 deletions
14
server.js
14
server.js
|
@ -91,6 +91,20 @@ app.get('/pagecount', function (req, res) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/home', function (req, res) {
|
||||||
|
res.render('home.html', {pageCountMessage: null})
|
||||||
|
// if (!db) {
|
||||||
|
// initDb(function (err) {});
|
||||||
|
// }
|
||||||
|
// if (db) {
|
||||||
|
// var col = db.collection(counts);
|
||||||
|
// col.count(function (err, count) {
|
||||||
|
// res.render('home.html', {pageCountMessage : count, dbInfo: dbDetails });
|
||||||
|
// });
|
||||||
|
// }else{
|
||||||
|
// res.render('home,html', {pageCountMessage: null});
|
||||||
|
// }
|
||||||
|
});
|
||||||
// error handling
|
// error handling
|
||||||
app.use(function(err, req, res, next){
|
app.use(function(err, req, res, next){
|
||||||
console.error(err.stack);
|
console.error(err.stack);
|
||||||
|
|
|
@ -28,4 +28,14 @@ describe('Basic routes tests', function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('GET to /home should return 200', function(done){
|
||||||
|
chai.request(reqServer)
|
||||||
|
.get('/home')
|
||||||
|
.end(function(err, res) {
|
||||||
|
res.should.have.status(200);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
1
views/home.html
Normal file
1
views/home.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
home page
|
Loading…
Add table
Add a link
Reference in a new issue