Question to MDG: Building routing into core

I see what you did there. :stuck_out_tongue_winking_eye:

8 Likes

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.

3 Likes

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.

4 Likes

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.

1 Like

Which one? (-:
Or some new router?

2 Likes

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.

8 Likes

When packages break, thatā€™s a reasonable excuse to me.

1 Like

@AndreasGalster Can you give an example of packages breaking?

For those who like Iron Router, why not form a group to take over maintenance (that is, if Chris didnā€™t object)?

2 Likes

Thatā€™s a good point. Iā€™d also like if someone willing to help FlowRouter too :slight_smile:

3 Likes

Here is one: onRun hook is not fired EVER AGAIN when a hot code push happens Ā· Issue #1219 Ā· iron-meteor/iron-router Ā· GitHub

1 Like

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.

1 Like

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.

1 Like

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}}

Read more here.


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.

6 Likes

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.

Read more about here.

I didnā€™t get this. May be you were saying we need to use React for SSR at the end. right? :smile:

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.

1 Like