Disable iron router for a specific route

hey guys,

I would like to perform an authentication check in another “server” (a piece of express code embedded into meteor)

So if I make a call to server/api/ping it should return 'pong` (pong is return by the express code)

the problem is that Iron router constantly gets into the middle, and says route not found or in any case, my express code never gets executed…

any ideas thanks!

Change to flow router so your route only reside in client and so it does not bother you.
Iron-router reside both side (client/server) and will get in your way, or you will have to work with iron router server side routes.

thanks, so basically for each path on the server I want that my express code gets executed… any ideas for this? (now this code is not being run)

I use FlowRouter on the client and WebApp native server routing on the server like this


And so far so good :slight_smile:

This should be possible with Iron Router as well. I believe you need to define the route and specify it to be on the server only. Here is a piece of code from a project where I was playing with this.

Router.route('/webhooks/stripe/:id', { where: 'server' })
  .get(function () {
    // GET /webhooks/stripe
    // console.log(this);
    this.response.end('hello world');
  })
  .post(function () {
    // POST /webhooks/stripe
    console.log(this.request.query);

    var obj = this.request.body;
    obj['id'] = this.params.id;

    var json = EJSON.stringify(obj, {indent: true});

    this.response.writeHead(200, {
      'Content-Length': json.length,
      'Content-Type': 'application/json'
    });

    this.response.end(json);
  })
  .put(function () {
    // PUT /webhooks/stripe
  })

hey guys, thanks for you help!

So getting iron router is not the issue, that works fine. But I have the feeling that because iron router is active my ‘express server’ is not being called. (the code is not being executed)

We tried the simple example on GitHub - mhurwi/meteor-with-express-example: Example app showing a bare bones server-side Express app within a Meteor app succesfully…

or the issue could be that my express server is not really running? Because both iron router as well as express should be able to listen to the same path?

image