Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added ping route

  • Loading branch information...
commit f4a9d117b8d10bd114090f83881eb7d00714a84e 1 parent 9e23662
@cblanc cblanc authored
View
6 app/controllers/utils_controller.js
@@ -0,0 +1,6 @@
+exports.ping = function (request, response) {
+ response.jsonp(200, {
+ code: 200,
+ result: "pong"
+ });
+}
View
6 config/routes.js
@@ -1,11 +1,13 @@
var path = require("path")
var pagesController = require(path.join(__dirname, "../app/controllers/pages_controller")),
- postcodesController = require(path.join(__dirname, "../app/controllers/postcodes_controller"));
+ postcodesController = require(path.join(__dirname, "../app/controllers/postcodes_controller")),
+ utilsController = require(path.join(__dirname, "../app/controllers/utils_controller"));
module.exports = function (app) {
app.get("/", pagesController.home);
- app.get("/about", pagesController.about)
+ app.get("/ping", utilsController.ping);
+ app.get("/about", pagesController.about);
app.get("/docs", pagesController.documentation);
app.get("/postcodes", postcodesController.query);
app.post("/postcodes", postcodesController.bulk);
View
16 tests/integration.js
@@ -69,4 +69,20 @@ describe("Misc", function () {
done();
});
});
+});
+
+describe("Utils", function () {
+ describe("Ping", function () {
+ it ("should pong", function (done) {
+ request(app)
+ .get("/ping")
+ .expect(200)
+ .expect("Content-Type", /json/)
+ .end(function (error, response) {
+ if (error) throw error;
+ assert.equal(response.body.result, "pong");
+ done();
+ });
+ });
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.