I see what you did there.
So Iron Router is out the door then? I was going to start projects with Meteor but this makes me step back and wonder if Meteor is serious in the JS Framework game
Agreed, this is a web application framework, routes seem pretty essential. At least a very lightweight one should be a given.
iron:router
seems mostly well done but there are a few things that irk me. Specifically, I hate how you canāt easily inherit controllers and implicitly pass data from the parent controllers to the children
Although it looks like flow-router
supports thisā¦ is that true? I might switch over
Hopefully MGD comes out with a router of their own.
But If youāre just starting a project, consider Flow Router instead of Iron Router. The consensus is Iron Router is no longer maintained.
Iām very hesitant to invest in something so fundamental as a router, so I probably wonāt make the jump to Flow Router unless/until it gets official MDG support.
I think the fact that less than 6 months ago Iron Router was the promising Router to be trusted and used, and is now abandoned supposedly, is the perfect reason for MDG to take over the Router situation. It makes no sense to trust it to community, when this could happen again. This is too important for MDG to leave to community.
Not to mention IR has around 250+ open issues most of the time. I know they are not all bugs, but still for such a relatively small package.
I agree on routing being handled by MDG, but as an optional add on and not installed by default. Flow is less complicated so should stand a better chance at being a robust solution
Just to resurrect this as a reminder that MDG have announced that they will be bringing routing into core.
Which one? (-:
Or some new router?
Saturn V rockets were abandoned too, but they landed us on the moon. Weāve used iron router in every project to date and have gotten a lot of traction out of it. Maybe weāll migrate them to Flow router some day, but presently we donāt feel any urgent compelling reason to do that.
Weāve built several small applications and one very large application with Meteor, so when I hear all these criticisms I feel like people are mostly making excuses when they could be building applications.
When packages break, thatās a reasonable excuse to me.
For those who like Iron Router, why not form a group to take over maintenance (that is, if Chris didnāt object)?
Thatās a good point. Iād also like if someone willing to help FlowRouter too
Here is one: onRun hook is not fired EVER AGAIN when a hot code push happens Ā· Issue #1219 Ā· iron-meteor/iron-router Ā· GitHub
If MDG do provide a core router I hope itāll be optional.
Based on one of their current projects in splitting meteor-platform into smaller packages iām sure it will be.
But eitherway itāll give apps time/the choice to change over to the core router.
Having to do auth at the template level with Flow Router is far from ideal for me. Iron Router works fine (use template subs) and is already on both server & client. Accounts-UI still has to be migrated I believe, thereās no oauth integration working just yet.
Though @arunoda has said that FR v3 will do serverside rendering, I just hope we wonāt be forced to use React for it.
Seems like you donāt get it properly. Whenever you stop doing router level subscriptions(weāve good reasons for that), you canāt do template level authentication, other than checking for whether user loggedIn or not. Thatās because we donāt have data in the router level. (Meteor.userId()
does not need data).
This is the newest version of useraccounts core, which removes router level auth layer. Still you can flow-router specific stuff here. It uses loggedIn user checks in the router level. But it only check it with Meteor.userId()
.
UX in template level auth
Template level auth gives better UX to the user. You donāt need to render the content inside the loggedIn user. You can simply render the login form instead. This is a successful pattern used by many Meteor apps, including Telescope.
Router level is auth is proven?
In a typical PHP/Ruby kind of app, you can do auth level in the router level, because you have the data in the router layer. Client side apps are different. You donāt have the data in the router layer initially, you need to wait for that.
So, you need to show some loading screen whether you use IR, FR or anything else. So, even if you use router level auth, you need to interact with the layout layer to show the loading screen.
Even if you redirect the user, you need to show some message. Otherwise, user will get confused. Then you need to interact with the templating layer.
At the end of the day, you need to interact with the template level to do auth stuff, even you use it in the router layer. Thatās why we recommend it to do it in the template level.
Decoupling Auth Logic from the Template with Router level auth
This is the one other argument for router level auth. Client side apps is all about templates and UI. You canāt decouple auth with it. With template level auth, we can implement the auth logic per componenet/template basic. Thatās the same as we do it template level subs. So, we can build great reusable content with that. (Thatās one way to do it, if needed)
We can also isolate auth logic into a once place and use some helpers like this:
{{#ifUserLoggedIn}}
{{> editPostForm }}
{{/ifUserLoggedIn}}
I donāt think Template level auth is far from ideal. Itās the ideal solution.
That being said, I donāt think everyone needs to follow it. We make it extremely hard to do Router level auth in FlowRouter. If you going with Router level auth, Flow Router is not the option.
Adding server side routing to FlowRouter is very simple. But we didnāt do it for a purpose. Client side routing and Server side routing is two different thing for two different purpose. Apis are different in both case. Even if the APIs are the same, semantics will be different.
We also have a lot of great packages to do server side routing, just use them.
I didnāt get this. May be you were saying we need to use React for SSR at the end. right?
Yes, FlowRouter starts with React because SSR for React easy and itās there. We use React for https://kadira.io and I wanted to do SSR for that. Thatās why I start with React.
That does not mean, we wonāt have it for Blaze. We already had SSR for Blaze. But the problem is, client side templates are not available in the server by default. We donāt had a simple way to make it correct without tearing down some core packages.
But with Meteor 1.2, this will be simple. So, weāll have Blaze SSR too.
Iāll start it once I finish based SSR apis.
If someone wanna help me, try to make Blaze templates available on the server. Write a package for that. In 1.2 there are some Apis. See.