express-resource icon indicating copy to clipboard operation
express-resource copied to clipboard

express-resource will support express4?

Open angelochen960 opened this issue 10 years ago • 8 comments

Hi,

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

A.C.

angelochen960 avatar Mar 31 '14 10:03 angelochen960

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

gdbtek avatar Apr 14 '14 07:04 gdbtek

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

olalonde avatar Apr 18 '14 10:04 olalonde

Seems to work here! :+1:

milanvanschaik avatar May 10 '14 12:05 milanvanschaik

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

gdbtek avatar May 10 '14 14:05 gdbtek

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

dankahle avatar Mar 25 '15 21:03 dankahle

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

TylerBrock avatar Jul 21 '15 22:07 TylerBrock

@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)

olalonde avatar Jul 22 '15 09:07 olalonde

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.

TylerBrock avatar Jul 22 '15 16:07 TylerBrock