visionmedia / express-resource

Resourceful routing for Express
1.41k stars 140 forks source link

express-resource will support express4? #87

Open angelochen960 opened 10 years ago

angelochen960 commented 10 years ago

Hi,

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

A.C.

gdbtek commented 10 years ago

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

olalonde commented 10 years ago

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

milanvanschaik commented 10 years ago

Seems to work here! :+1:

gdbtek commented 10 years ago

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

dankahle commented 9 years ago

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 commented 9 years ago

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

olalonde commented 9 years ago

@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 commented 9 years ago

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.