I want to create a multi-page Meteor web and mobile application. I am therefore looking for routing services.
From research, I gathered Iron Router is what I am looking for. But many tutorials also mention Meteor.Router
What are the differences (if any) between Iron Router and `Meteor.Router`?
iron:router has been the de facto standard routing solution for Meteor for over a year now, you should definitely use it, it's probably the most downloaded atmosphere package.
Please note however that the project has not been updated for several months and another router (FlowRouter) package emerged, focusing only on client-side routing and managing subscriptions, it takes a different approach than iron:router by making the routing code non-reactive by default.
Meteor.Router is a deprecated package that used to be maintained by one of the two main contributors to iron:router, tutorials mentioning this are clearly outdated.
The iron:router guide is a recommended reading to understand some advanced concepts like server-side and client-side routing.
Related
official github page of react-router-redux says that the project is no longer maintained and is now deprecated. They recommend to use connected-react-router instead.
react-router-redux has:
31k stars
884 watch
6k forks
while connected-react-router has only:
1053 stars
28 watch
108 forks
I am starting developing a complete Q/A social networking website using react v4, will it be worthy or smart idea to use connected-react-router here?
while posting the question I just noticed that the stackoverflow doesn't even have connected-react-router tag.
If you are going to use Redux to manage your application state, use react router for routing, and want to synchronize your route history with your app state and manage routing through redux, then this will be fine to use. While I've only begun using it recently myself it's made been pretty straight forward for managing routing, including route data.
You also pointed out that:
react-router-redux says that the project is no longer maintained
For this reason alone I would not use react-router-redux, unless you plan to maintain it yourself. Disregarding features and bugs, you'd also have to be concerned with any potential security issues that come up. Please also see this dicussion they're having about it's deprecation in their GitHub issues https://github.com/ReactTraining/react-router/issues/6358
Just to reiterate, if you need, or think you'll need, to synchronize your router state with your redux store then this is not a bad tool to use. If you don't think you'll need this then don't use it so your project doesn't become bloated.
That being said, I've also seen this alternative https://github.com/salvoravida/redux-first-history which looks interesting. It looks to offer a more decoupled approach to history, routing, and state than the connected-react-router, but I haven't used it yet.
I was enthusiast using Angular2 with Meteor, so I started a project with ng2 and Meteor. But more and more I am asking questions like:
Is ng2 deprecated router the way to go ?
What is the purpose to use ngForm validation if I use collection2 and autoform to do most of my form validation.
What are the benefits of ng2 architecture vs Blaze ?
So at the end, I am not even sure of why I am using ng2. There is not that much recent and relevant discussions on the topic. Is that the question that is already answered, obvious or just not so relevant ?
What are the pros/cons of using Angular 2 versus using Blaze ?
Blaze was raised with Meteor and is probably linked to his success. And ng2 could be as famous as ng1.
To be used in serious projects, which one is going to be 'more maintained and last longer' ?
Regards
PS: Also looking at https://builtwithmeteor.com, Blaze appears to be used more.
The Angular 2 router is deprecated but it's still the only router available to use at the moment.
In the future versions of Angular 2, a new router will be available.
So right now- the deprecated router should be used, and I think that it has all the features that you need from a Router.
You can choose to do the validations of the fields as you like.
Personally, I think that validation should occur in both client and server, so Angular 2 take care of the validations that needed to check in the UI and give feedback in the UI, and the Meteor validations should occur in server side and validate things like duplicates, data logic and such, along with fields validations that done by SimpleSchema.
I think that Angular 2 at the moment provides a better solution for client side development - much of it is because of the decorators that in use, the code is much clearer and easy to understand.
Also, Angular 2 is more that UI binding (which Blaze is...) and give you Dependency Injection, Router, Services and more features that usually required in the UI (in Blaze you need to use external packages for each one of these features).
Keep in mind that few months ago, Meteor team declared that UI developers should consider using another client side framework, and consider migrating from Blaze (they recommended Angular 2 / Angular with angular-meteor.com or React).
If you already have Blaze application, I think that you should consider migrating to Angular 2.
The Angular2-Meteor (www.angular-meteor.com) team is working right now on a full step-by-step tutorial for coexistence and migrating Blaze application to Angular 2.
Just started to discover meteor. created app with DiscoverMeteor book, but misunderstood many moments. then read Your first meteor application and Your first meteor application books. Realized that Todos example is really too simple to cover many important things. And only after that I found the official guide on Meteor.com! now reading about all these complex (for my opinion) things. and have 2 questions:
What router should I prefer to use? I want to create fast app with lots of data loading from the server. Found information that Iron router is deprecated, and Flow router is recommended nowadays, but also found that flow router can not route on server, only on client. And that exactly client routing is the reason why for example soundcloud is really slow. So that is the question - I know nothing about server/client routing, but want to make right decision for the future project.
What ui-framework to use? I read that blaze is easy to start, but react js is really powerful. So: is Blaze enough for serious project (like a popular blog)? Or do I have to learn react js in order not to rewrite code in the future?
I am working with Meteor 1.3.2.4, which is latest in market and believe, you don't have to do anything out of the box to go with experimental UI-Frameworks and stuff.
Blaze template which is handlebars based implementation is best.
Blaze template is very well glued with Socket.io, futures and DDP implementation for cutting edge implementation for asynchronous and reactive behaviour on UI.
Blaze is really good for cumbersome, heavy data websites as well. If you have any doubt, i can skype and show you what i have implemented in just 2 days on development using everything given by Meteor.
React.js, Koa.js (re-written Express framework), express etc are very good and powerful, but I think implementing it at initial level of your grasp is overkill. Go with Blaze first.
There are hundered sitting and developing Meteor.js just for you to be comfortable. I am not at all biased, I am giving you my open opinion.
I worked with Laravel 5.2, Play framework, MEAN.io, DJango in past, but believe there is nothing like pure Meteor js with there own packages. There are many videos on youtube like Meteor nights and stuff where you can find the developers from all around the world developing huge stuff just using stuff given by Meteor js.
For routing flow-router is good, even iron:router is awesome and easily gettable.
This video can guide you very well.
Flow Router is the recommended router by the official Meteor Guide. It's also the popular choice these days, and for a reason: it's a high quality router implementation.
As for MVC, it's really like choosing a religion. React has a huge community, possibly a bright future, and it's not Meteor-only unlike Blaze. But some folks find Blaze templates nicer than JSX files. I think it's easier to get help on StackOverflow if you pick React, but Blaze might be easier to get started.
Maybe this post helps a bit: How to set up React with Meteor?
In recent docs, like the Discover Meteor book and the Iron Router guide on github use Router.route for each route. But it's pretty common to see routes defined in Router.map() using this.route. Is there any real difference or a reason to choose one way over the other?
Router.map is part of the pre-1.0 API. While is still works at the time of this writing, it may be deprecated in the future. I'd strongly recommend following whatever is in the current version of the official docs.
There are lots of routing related questions for earlier Meteor releases on SO, but where are we at in terms of best practices for basic routing in Meteor version ≥ 1.0?
I’ve previously used 3rd party packages such as Iron Router, Meteor-Router etc. From my understanding however, I could now achieve the same results by using the webapp package (https://docs.meteor.com/#/full/webapp) that I get ”for free” when running meteor create myRoutableApp.
Folks I've talked to that know far more than I do have indicated that Iron Router is the way to go. It's been updated for 1.0 and has a ton of really cool features.
In terms of using webapp, the documentation states that webapp can only function on the server side, which limits it to exposing your application's data to external HTTP requests. It's useful for creating an API that others can access, but it's not actually going to be useful to let people navigate around your app from the client side of things.