Router
Express router which provides a ping endpoint.
Installation
$ npm install express-router-ping
Usage
var router = ;
router
A mountable Express route handler.
var express = ;// Create a new application:var app = ;// Mount the route handler on the application:app;
Routes
GET /ping
URI endpoint for pinging the server application.
Response: 200 (text/plain)
The response body will be
pong
Examples
From the command-line,
$ curl 'http://127.0.0.1:<port>/ping'
From another Node application,
var request = ;;{if errorconsole;return;console;}
A successful request will receive the following response body:
pong
Examples
var request =express =router = ;// APP //var app = ;// Mount the router on the application:app;// Create an HTTP server:app;{console;;}// RUN //var count = 0;{if ++count > 10process;;}{;}{if errorthrow error;console;console;;}
To run the example code from the top-level application directory,
$ node ./examples/index.js
Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
License
Copyright
Copyright © 2015. Athan Reines.