Socket
Socket
Sign inDemoInstall

express-resource

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-resource - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

test/fixtures/cat.js

7

examples/user.js

@@ -1,4 +0,1 @@

require.paths.unshift(__dirname + '/../support');
/**

@@ -38,7 +35,7 @@ * Module dependencies.

res.send('removed ' + req.params.user);
}
},
login: function(req, res){
res.send('logged in ' + req.params.user);
}
},

@@ -45,0 +42,0 @@ logout: function(req, res){

0.2.4 / 2011-12-28
==================
* Fixed windows path join. Closes #43
* Fixed _examples/user.js_
* Fixed resource id when multiple segments are present. Closes #36
0.2.3 / 2011-09-23

@@ -3,0 +10,0 @@ ==================

@@ -14,14 +14,18 @@

var express = require('express')
, join = require('path').join
, lingo = require('lingo')
, en = lingo.en
, orderedActions = [
'index' // GET /
,'new' // GET /new
,'create' // POST /
,'show' // GET /:id
,'edit' // GET /edit/:id
,'update' // PUT /:id
,'destroy'// DEL /:id
];
, en = lingo.en;
/**
* Pre-defined action ordering.
*/
var orderedActions = [
'index' // GET /
,'new' // GET /new
,'create' // POST /
,'show' // GET /:id
,'edit' // GET /edit/:id
,'update' // PUT /:id
,'destroy' // DEL /:id
];

@@ -101,3 +105,3 @@ /**

return this.name
? en.singularize(this.name)
? en.singularize(this.name.split('/').pop())
: 'id';

@@ -124,3 +128,3 @@ });

if ('/' == path[0]) path = path.substr(1);
else path = join(this.param, path);
else path = path ? this.param + '/' + path : this.param;
method = method.toLowerCase();

@@ -177,4 +181,5 @@

// relative base
resource.base = this.base + (this.name ? this.name + '/': '') +
this.param + '/';
resource.base = this.base
+ (this.name ? this.name + '/': '')
+ this.param + '/';

@@ -181,0 +186,0 @@ // re-define previous actions

{ "name": "express-resource"
, "description": "Resourceful routing for express"
, "version": "0.2.3"
, "version": "0.2.4"
, "author": "TJ Holowaychuk <tj@vision-media.ca>"

@@ -10,9 +10,8 @@ , "contributors": [

, "devDependencies": {
"connect": "1.4.x"
, "express": "2.3.x"
"connect": "1.8.x"
, "express": "2.5.x"
, "ejs": "0.4.x"
, "expresso": "0.7.x"
, "lingo": "0.0.4"
, "expresso": "0.9.x"
, "qs": "0.1.x"
, "should": ">= 0.0.1"
, "should": "*"
}

@@ -19,0 +18,0 @@ , "keywords": ["express", "rest", "resource"]

@@ -33,3 +33,3 @@

{ body: '["tobi","jane","loki"]'
, headers: { 'Content-Type': 'application/json' }});
, headers: { 'Content-Type': 'application/json; charset=utf-8' }});

@@ -66,3 +66,3 @@ assert.response(app,

{ body: '["tobi","jane","loki"]'
, headers: { 'Content-Type': 'application/json' }});
, headers: { 'Content-Type': 'application/json; charset=utf-8' }});

@@ -87,3 +87,3 @@ assert.response(app,

{ body: '["tobi","jane","loki"]'
, headers: { 'Content-Type': 'application/json' }});
, headers: { 'Content-Type': 'application/json; charset=utf-8' }});

@@ -90,0 +90,0 @@ assert.response(app,

@@ -318,3 +318,16 @@

{ body: 'logout' });
},
'test several segments': function(){
var app = express.createServer();
var cat = app.resource('api/cat', require('./fixtures/cat'));
assert.response(app,
{ url: '/api/cat' },
{ body: 'list of cats' });
assert.response(app,
{ url: '/api/cat/new' },
{ body: 'new cat' });
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc