Compatibility with Express 3 #55

Couto opened this Issue Mar 6, 2012 · 30 comments


None yet

Couto commented Mar 6, 2012

I'm currently using express 3.0.0alpha1-pre (ok, i know it's alpha) and express-resource 0.2.4 (from npm)
As soon as I require express-resource i get this error:

TypeError: Cannot read property 'methods' of undefined
    at Object.<anonymous> (/home/myUser/web/myWebsite/private/node_modules/express-resource/index.js:234:15)

That line refers to the following code block

express.router.methods.concat(['del', 'all']).forEach(function(method){
  Resource.prototype[method] = function(path, fn){
    if ('function' == typeof path
      || 'object' == typeof path) fn = path, path = '';, path, fn);
    return this;

My main question is: Are you planning to make express-resource compatible with Express 3, if so, do you have any ETA?
Thanks for your time =)

I'd like to know, too.

btw, router is now Router in express3, so above error is easy to circumvent.
but again, express.HTTPServer which is not defined in express3 due to the structural change causes an error at line 252.

panosru commented Apr 16, 2012




rdrey commented May 6, 2012



forste commented May 17, 2012



express-resource for express3 would be great!

jedwood commented Jun 5, 2012



Change router to upper case
and on line 252 change express.HTTPServer.prototype to

so it's app.resource

It's probably a flawed fix, though it works to get it running.

didn't work for me... though I may not have edited it correctly

The latest fix for this is to add "methods" as a dependency of express-resource, and then use do

require('methods').concat(['del', 'all']).forEach(function(method){

that got me past the original error, but then I hit what I think @danschumann was fixing. However I couldn't get his solution to work.

Tied all of the above with no joy

koenbok commented Jul 17, 2012


a1arias commented Jul 18, 2012


Is @visionmedia still working on this? It looks like the express 3 compatibility branch hasn't been touched in over a month.

tbjers commented Sep 2, 2012

+1 extra-bump shin-kick


+1 This is the only thing keeping me on express2.

joakim commented Sep 3, 2012

I'll add my +1, but also mention that TJ started working on this last month. Check out the branch if you think you can help out.

Also, see #61. It's not as straight forward as it seems.




ghost commented Sep 15, 2012


realyze commented Sep 18, 2012


wprl commented Sep 26, 2012

+1 :) Any way I can help?

a1arias commented Sep 26, 2012

Everyone who has +1ed this issue:

Take a look at the examples "resource" and "MVC" in the express repo. It's super easy to create your own "resource" middleware. I don't think anyone should waste the time to make this module compatible with express3 because auto-loading routes for resources is already built right in (with some improvements).

@tj tj closed this in f093235 Oct 6, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment