New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

api-routes

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-routes - npm Package Compare versions

Comparing version

to
0.1.6

11

example/routes/inheritance/inheritance.js

@@ -8,5 +8,7 @@ // Here we show how to do endpoint inheritance

middleware: function (req, res, next) { req.tosay = 'my'; next() },
// You can put middleware here
get: function (req, res) {
res.send({method: 'get', endpoint: 'inheritance'});
res.send({method: 'get', endpoint: 'inheritance', tosay: req.tosay});
}

@@ -22,5 +24,10 @@ })

middleware: [
function (req, res, next) { req.tosay = 'name'; next() },
function (req, res, next) { req.tosay += 'is'; next() }
],
// You can put middleware here
get: function (req, res) {
res.send({method: 'get', endpoint: 'inheritance.chain'});
res.send({method: 'get', endpoint: 'inheritance.chain', tosay: req.tosay});
}

@@ -27,0 +34,0 @@ })

@@ -113,3 +113,8 @@ // api.js

var url = (parent.url || '') + (child.url || '');
return _.extend(_.omit(parent, this.methods), child, {url: url});
return _.extend(_.omit(parent, this.methods), child, {
url: url,
middleware: parent.middleware && child.middleware ?
[].concat(parent.middleware).concat(child.middleware) :
child.middleware || parent.middleware
});
};

@@ -116,0 +121,0 @@

2

package.json
{
"name": "api-routes",
"description": "A declarative system for creating express API routes.",
"version": "0.1.5",
"version": "0.1.6",
"author": "Jon Eisen <jon.m.eisen@gmail.com>",

@@ -6,0 +6,0 @@ "scripts": {

@@ -45,5 +45,5 @@ var tests = module.exports = {};

tests.inheritance = makeTest('get', '/inheritance', {method:'get', endpoint: 'inheritance'});
tests.inheritance = makeTest('get', '/inheritance', {method:'get', endpoint: 'inheritance', tosay: 'my'});
tests.inheritanceChain = makeTest('get', '/inheritance/chain', {
method:'get', endpoint:'inheritance.chain'
method:'get', endpoint:'inheritance.chain', tosay: 'mynameis'
});

@@ -50,0 +50,0 @@