-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routes not working if placed inside “if (Meteor.isClient)” #897
Comments
The 404 not found code has been removed but not released yet. But with that said it's probably generally better to define your routes outside of a client block so the server knows about them. In the future the line between client and server routes will probably blur.
|
Q1: Router.route('/', function() {
this.render('hello');
}); // it can work
if(Meteor.isClient){
Router.route('/', function() {
this.render('hello');
});
} // it can't work
if(Meteor.isServer){
Router.route('/', function() {
this.render('hello');
});
} // it can't work
Q2: it's my project tree
client
test.js
test.html
test.css
server
test.js
route.js
// it can work
client
test.js
test.html
test.css
server
test.js
route.js
// it can't work
there is the route.js 's code:
Router.route('/', function() {
this.render('hello');
}); |
Thank you guys. Also, I am trying to create a route for the application in a smart-package. <--- package.js --->
<--- mypack.js --->
<--- mypack.html --->
So, as per your comments it is not possible to declare routes in a smart-package as 'mypack.js' would be available only on client or server? |
@cmather could you shortly tell us for what reason the server should know about client routes ? Thanks. |
console.log(Package.onUse) // undefined
// So unexpected
// I was a meteor's beginner there's my meteor infos:
// meteor's version 0.9.3.1
// OS mac 10.9.5 |
@cmather it seems like this is coming up a bit. I've opened #928 to make sure this is clear in the guide. @boustanihani - there are many reasons but the simplest is so you server can write the paths of such routes (e.g. in emails). Is there any reason why not? Closing this. You should define routes globally. |
Are non-global routes supported yet? It would be essential to allow this in a modular plugin system (similar to rails) where plugins (/packages) can apply additional routes to the overall system. |
good day..>> |
Environment: iron:[email protected] with meteor 9.3.1.
<--- html --->
<--- js --->
The route is not working in the above case. However, it works properly if route is placed outside "if (Meteor.isClient) {".
The text was updated successfully, but these errors were encountered: