I am excited to release Galvanized Iron Router 2.0.0 - the rustproofed successor to that routing package we all know and love!
Just as galvanizing iron makes it rust-resistant and longer-lasting, this fork gives Iron Router a new lease of life with full Meteor 3.0+ compatibility while maintaining support for Meteor 2.0+.
This was a byproduct of my own efforts to upgrade my existing codebases. I hope this helps everyone else in their quest to modernise their mature Meteor apps. Feel free to fork this package. You can find it on GitHub here:
What’s New:
A single unified package: All the iron:* packages you used to install separately are now consolidated into one package:
No more juggling iron:core, iron:layout, iron:controller, etc.
Simplified installation and maintenance
Modern Meteor Compatibility:
Supports both Meteor 2.0 and 3.0, making it easier to transition to the latest Meteor at your own pace.
When run under Meteor 3.0+, it will support the promise-based async/await execution model.
When run under Meteor 3.1+, it will use Express instead of the Connect middleware
Installation:
Upgrading is simple - your existing code works unchanged:
Apart from combining the separate Iron Router packages into one, these are the differences between Galvanized Iron Router and the Polygonwood fork:
The implementation of RouteController.prototype.dispatch():
Galvanized Iron Router maximises backward compatibility by checking for the presence of Meteor Fiber support. If it’s enabled, it will dispatch the route function within a Fiber, as Iron Router does. Otherwise it will dispatch the route function asynchronously within a try/catch block.
Here are the two different implementations side-by-side:
Galvanized Iron Router uses the functionality of Express 5 as the body parser when running under Meteor 3.1+. The Polygonwood fork retains the original Iron Router functionality that utilises the body-parser NPM package.
We’re trying to use this in our Meteor 3 update and are getting a fatal crash on the server where the package uses Random.id() without importing/using it in package.js. I created an issue and PR for it.
In Meteor 2.16, I had the following pattern in startup/client/routes.js:
// Configure and limit how requests are handled
Router.configureBodyParsers = function() {
Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({
extended: true,
limit: '10mb'
}));
Router.onBeforeAction(Iron.Router.bodyParser.json({
limit: '10mb'
}));
};
I wasn’t sure how to handle this in Meteor 3. On a consult with our friend Claude, he’s saying the above isn’t compatible with Meteor 3’s Express integration, and to add the following pattern somewhere in startup/server:
Guess it’s probably time to switch to Flow Router anyway. This “Galvanized” version of Iron Router has been a bumpy ride. Looks like @vlasky left the community? Hasn’t logged on in a year.
I’m still around, just have been busy with other work. I’ll take a look at this at my next free moment. You are also free to try fixing it with the assistance of agentic tools.
I also recall having difficulties with Rspack when I last updated my main Meteor app to Meteor 3.4 earlier this year.
Thanks for coming back! Totally agree here. However, I became discouraged about the time required because it looks like the breakage was due to your ES6/Meteor 3 overhaul. I was worried it wouldn’t be a straightforward fix. I’ve also had PRs waiting for extended bits of time in the past on this project. Appreciate you jumping back in though. Thanks for adding the query param test too.