0.6.0 • Published 4 years ago
simple-api-management-nodejs v0.6.0
Simple API Management Node.js middleware
Installation
This is a Node.js module available through the npm registry.
$ npm install simple-api-management-nodejs
Usage
Get your API key from our Simple API Management UI. your API key will be displayed after signign up and creating an API.
const simpleAPIManagement = require('simple-api-management-nodejs');
var options = {
apiKey: 'add your API key here',
rateLimits: true, // default
metrics: true, // default
// [OPTIONAL]
// identifier can be used to apply rate limits for specific attributes like ip or user
identifier: function (req, res) {
if (req.user) {
return req.user.id;
}
return undefined;
},
};
app.use(simpleAPIManagement(options));