Search code examples
meteoriron-routerflow-router

Use flow router and iron router in Meteor?


I'm using flow router for client side routing in a Meteor app. I need to use a router on the server side to expose a webhook. So, I plugged in iron router, but iron router now injects html into my app complaining I need to configure routes in the app. I guess it thinks at least one client side route should exists, er? I have implemented one iron router route in the server like so:

Router.map(function() {
  this.route('webhooks', {
  layoutTemplate: null,
  path: '/webhooks/:source',
  where: 'server'
})
.post(function() {
  // auth, stuff happens, etc //
  this.response.end('Thank you, come again!');
  });
});

Is there some configuration I can add to iron router that tells it to calm down?


Solution

  • You may want to use Picker instead

    https://github.com/meteorhacks/picker/

    It is designed as a dedicated server side router for meteor.

    Also recommended by FlowRouter https://kadira.io/academy/meteor-routing-guide/content/server-side-routing-rest