diff --git a/server.js b/server.js index 36dc199..f28c4d9 100644 --- a/server.js +++ b/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 app.use(function(err, req, res, next){ console.error(err.stack); diff --git a/tests/app_test.js b/tests/app_test.js index 28da5a0..2e75b68 100644 --- a/tests/app_test.js +++ b/tests/app_test.js @@ -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(); + }) + + }) }) diff --git a/views/home.html b/views/home.html new file mode 100644 index 0000000..716ff51 --- /dev/null +++ b/views/home.html @@ -0,0 +1 @@ +home page \ No newline at end of file