Skip to content

Commit

Permalink
add travis and coveralls integration
Browse files Browse the repository at this point in the history
  • Loading branch information
yunong committed Oct 21, 2016
1 parent ad46899 commit 852247a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: uy0bjN238cd6grnNLygQSkVNboKArjsFc
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Thumbs.db
/node_modules/
npm-debug.log
yarn.lock
coverage

# build task results for ci
/ci/
Expand Down
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
node_js:
- "0.12"
- "4"
- "6"
before_script: npm install -g yarn
script: make all
after_success:
- make report-coverage
- make nsp
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# restify-enroute
[![NPM Version](https://img.shields.io/npm/v/restify-enroute.svg)](https://npmjs.org/package/restify-enroute)
[![Build Status](https://travis-ci.org/restify/enroute.svg?branch=master)](https://travis-ci.org/restify/enroute)
[![Coverage Status](https://coveralls.io/repos/restify/enroute/badge.svg?branch=master)](https://coveralls.io/r/restify/enroute?branch=master)
[![Dependency Status](https://david-dm.org/restify/enroute.svg)](https://david-dm.org/restify/enroute)
[![devDependency Status](https://david-dm.org/restify/enroute/dev-status.svg)](https://david-dm.org/restify/enroute#info=devDependencies)
[![bitHound Score](https://www.bithound.io/github/restify/enroute/badges/score.svg)](https://www.bithound.io/github/restify/enroute/master)
[![NSP Status](https://img.shields.io/badge/NSP%20status-no%20vulnerabilities-green.svg)](https://travis-ci.org/restify/enroute)

This module provides configuration driven route installation for restify.
Instead of having to declare routes in code, you can create a confiuration file
like this:

```json
{
"schemaVersion": 1,
"foo": { // route name
"get": { // HTTP method
"source": "./test/etc/fooGet.js" // path to handler source
"foo": {
"get": {
"source": "./test/etc/fooGet.js"
},
"post": {
"source": "./test/etc/fooPost.js"
Expand Down Expand Up @@ -39,7 +47,7 @@ like this:
}
}
```
this declares the route name, http method, and handler file on disk. this
This declares the route name, http method, and handler file on disk. this
module will install these routes onto a restify server for you. The
corresponding handler file would look like:

Expand All @@ -59,7 +67,7 @@ when done.
* `opts.server` The restify server to install the routes on to.
* `opts.config` The POJO of the enroute config.
* `opts.configPath` The path to the enroute config on disk.
* `cb` The callback. Returns `Error` if there's an issue installing the routes.
* `cb` The callback. Returns `Error` if there's an error installing the routes.

Note only one of `opts.config` or `opts.configPath` is needed. The module will
either read in the file from disk, or use a pre-populated POJO.
Expand All @@ -68,6 +76,7 @@ either read in the file from disk, or use a pre-populated POJO.
```javascript
const enroute = require('restify-enroute');
const restify = require('restify');

const CONFIG = {
schemaVersion: 1,
foo: {
Expand Down Expand Up @@ -96,7 +105,7 @@ enroute({
console.error('unable to install routes');
} else {
console.log('routes installed');
SERVER.listen(8080);
SERVER.listen(1337);
}
});
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
},
"devDependencies": {
"chai": "^3.5.0",
"coveralls": "^2.11.14",
"eslint": "^3.8.1",
"istanbul": "^0.4.5",
"jscs": "^3.0.7",
Expand Down

0 comments on commit 852247a

Please sign in to comment.