meteorhacks / picker

Server Side Router for Meteor
MIT License
182 stars 30 forks source link

Picker route style should be somewhat similar to FlowRouter #9

Open smeijer opened 9 years ago

smeijer commented 9 years ago

It seems to me that for example middleware is a global assignment to Picker, and there is no action parameter, but just a function as second argument to the route method.

Picker is great, and when migrating from Iron-Router to FlowRouter + Picker, it should really help if Picker felt a bit more like FlowRouter. For example:

var bodyParser = Meteor.npmRequire('body-parser');

var postRoutes = Picker.filter(function(req, res) {
  return req.method == "POST";
});

Picker.route('/post/:id', {
  middlewares: [bodyParser],
  filters: [postRoutes],
  action: function(params, req, res, next) {
    // ...
  }
});

Like I said, Picker is really great! So I'm not trying to be negative about it. Just trying to help make it feel more familiar.