mashape-tools
v0.0.15
Published
Connect-style middlewares to perform security checks on your Mashape-API backend by validating HTTP-Headers and allowed Proxy-IPs. It also provides a simple service-container for Mashape-APIs
Downloads
21
Maintainers
Readme
Mashape-Tools
Connect-style middlewares to perform security checks on your Mashape-API backend by validating HTTP-Headers and allowed Proxy-IPs. It also provides a simple service-container for Mashape-APIs
Getting Started
Install the module with: npm install mashape-tools
To use the IP-Filter download the official list of Mashape-IPs as JSON and store it within your application.
var express = require('express'),
app = express(),
mashape = require('mashape-tools');
// Enable IP-Filter
app.use(mashape.ipFilter({
iplist: '/path/to/iplist.json' // or an array of IPs
}));
// Enable Proxy-Secret-Filter
app.use(mashape.headerFilter({
proxySecret: 'YourMashapeProxySecret',
additionalHeaderChecks: [
{ name: 'x-your-header', value: 'your-header-value' }
]
}));
// Use the Service Container
app.use(mashape.serviceContainer({
mashapeKey: process.env.MASHAPE_KEY
}));
// ...
Documentation
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add tests for any new or changed functionality. Lint and test your code using Grunt.
License
Copyright (c) 2014 Marco Grätsch
Licensed under the MIT license.