I'm trying to creating a custom map for a resource,
app.namespace('/v1', function(){
var sessionResource = app.resource('session', require('./routes/v1/session'));
sessionResource.map('/test', sessionResource.index);
});
the maps breaks as follow, however without the custom map the ns and the resource work smoothly
/home/kuryaki/piitri/newApi/node_modules/express-resource/index.js:125
if ('/' == path[0]) path = path.substr(1);
^
TypeError: Cannot read property '0' of undefined
at Resource.map (/home/kuryaki/piitri/newApi/node_modules/express-resource/index.js:125:18)
at HTTPServer.<anonymous> (/home/kuryaki/piitri/newApi/app.js:44:31)
at HTTPServer.exports.namespace (/home/kuryaki/piitri/newApi/node_modules/express-namespace/index.js:31:6)
at Object.<anonymous> (/home/kuryaki/piitri/newApi/app.js:42:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
the index method exists thats how i actually test it
GET /v1/session at localhost
i have tried with node v0.6.14, v0.8.4 and v0.9.0pre and none work am i doing something wrong?
express-resource is not yet fully express 3 compatible.
You can however install a special branch of express-resource using this in your package.json
"express-resource":
"git://github.com/visionmedia/express-resource.git#add/express3x-support"
or npm install git://github.com/visionmedia/express-resource.git#add/express3x-support
from the command line.
I've been using that branch of express-resource happily for a while now. I've found out about this branch from express-resource's github issues page.