1.0.3 • Published 6 years ago

nf-token v1.0.3

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
6 years ago

nf-token

NilFactor Token is a simple package to allow you to add an api token to your restify or express server.

//...
var token = require('nf-token');
server.pre(token.verifyRequest);
//...

Create a config directory in your project with a json file called development.json or <NODE_ENV>.json whatever your NODE_ENV=thisname with the following

{
    "nfToken": {
        "apiKey": "key",
        "apiToken": "token1"
    }
}

Then when you make requests to your api create a header key/pair value of "key: token1" (req.headers.key = "token1"), if using the above example.

To allow routes that do not require a token simply doe

token.addIgnoreRoute('/');
token.addIgnoreROute('/hello/*');
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago