Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

express-resource will support express4? #87

Open
angelochen960 opened this issue Mar 31, 2014 · 8 comments
Open

express-resource will support express4? #87

angelochen960 opened this issue Mar 31, 2014 · 8 comments

Comments

@angelochen960
Copy link

Hi,

looks handy express-resource, will it support express 4 too? thanks,

A.C.

@gdbtek
Copy link

gdbtek commented Apr 14, 2014

+1. I want to ask this question as well.

@olalonde
Copy link

For what it's worth, I've written a similar module for Express 4.x: https://github.com/olalonde/resourcemap

@milanvanschaik
Copy link

Seems to work here! 👍

@gdbtek
Copy link

gdbtek commented May 10, 2014

Thanks @ milanvanschaik . I will start using it and I hope this project is still going!

@dankahle
Copy link

ditto on the express 4. The nested routes are broken as they're using express3's app.routes, which no longer exists. It crashes on that line:
https://github.com/expressjs/express-resource/blob/master/index.js#L197

@TylerBrock
Copy link

+1 need this badly... is anyone working on this anymore?

@olalonde
Copy link

@TylerBrock FWIW, I haven't felt the need to use express-resource anymore with the new Router functionality. It's quite easy to setup resource like routes. For example:

function router() {
  return new express.Router({
      mergeParams: true, // inherit parent router's params
  });
}

  var logsRouter = router()
    .get('/', logs.index);

  var txsRouter = router()
    .use(bodyParser.json())
    .get('/:txID', txs.show)
    .get('/:txID/logs', logsRouter)
    .post('/', txs.create);

  app.use('/txs', txsRouter)

@TylerBrock
Copy link

Thank you! It definitely is much easier to do now but it would still be nice to have loaders (you can probably accomplish this with middleware though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants