express-resource
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -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 @@ ================== |
35
index.js
@@ -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' }); | ||
} | ||
}; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
34913
6
23
882
0
1