How do you route in meteor?


#1

I am new to meteor and I was wondering how do you use URLs if you don’t want the application to be single page.
Also, what is the best way to organize the files in meteor?


#2

There are 2 major routers: flow-router and iron-router.
Iron router was the first and is widely supported.
But I still prefer Flow, cause it is not so complex and is doing just routing.


#3

Thanks @shock. By any chance, would you have some resources to point beginners to?


#4

There are two main router packages for Meteor at the moment: iron-router and flow-router.

If you search these forums for those two, you’ll find discussion on their respective strengths. You can find a simple example of each (along with how to do authorization using the meteor-roles package) here: https://github.com/alanning/meteor-roles/blob/master/examples . The readme has instructions for how to run them.

In general, if you are trying to find a package to do X, try searching atmosphere. Usually you’ll find something useful.

Regarding file organization, my personal opinion is its easier for people to read and modify your code base if you separate things functionally, both on the client-side and server-side. So you’d have a directory for user management where all the associated html, js, css, jsx, etc. files go. And another directory for your user profile files.

File organization is definitely something you can find many opinions about so I’d encourage you to search a bit and see what others have to say.


#5

Flow router here https://github.com/kadirahq/flow-router#meteor-routing-guide
And iron router also on github.

All packages can be looked up on https://atmospherejs.com/
And there use to be also link to github.


#6

Thank you so much @shock and @alanning for the explanations. I will check these out soon.