How do I define server-side only routes with webpack:webpack?

Suppose I define the following in server/route.js (using iron:router):

Router.route('/login')
  .post(function () {
    this.response.end('post request\n');
  });

If I create a POST request to http://localhost:3000/login, I get my default root route (/) as a response. I also tried using the lower level WebApp API. Same issue.

I feel like my understanding of webpack is lacking. Please enlighten me, thank you.

Getting closer… the following code (server/meteor.startup.js) works in development mode, but when I enable the --production flag, I get a 404 response.

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

Meteor.startup(function () {
  WebApp.connectHandlers
    .use(bodyParser.urlencoded({ extended: false }))
    .use(function(req, res, next) {
      if (req.url === "/login" && req.method === "POST") {
        res.end("hello world");
      } else {
        next();
      }
    }
  );
});

In entry/server/webpack.conf.js (following the kickstart-simple project), I added a login entry point:

module.exports = {
  entry: {
        web: './entry.js',
  	login: './login.js' // added login entry
  }
};

I also made a corresponding empty login.js file.

That seems to make my WebApp handle work.

http://memesvault.com/wp-content/uploads/I-Have-No-Idea-What-Im-Doing-Dog-01.jpg