I am using iron:router@1.0.0-pre3 with meteor 9.3.1.
I am creating a smart package. I want to define routes inside the smart package and not in the main app.js file.
I tried adding following code in the .js file for smart-package:
Router.route('/path', function () {
this.render('someTemplate');
});
The above code gives a "Router not defined" error. Don't know what should be added to "api.use" in "Package.onUse(function(api)" for Iron:Router in the "package.js" file.
Is it possible to define routes inside smart-package? How can I do this?
Update:
After adding iron:router
to api.use
the "Router not defined" error is gone.
However, the route is still not working. I have added the route in mypack.js
. mypack.js
is only available to client.
Package.onUse(function(api) {
api.versionsFrom('METEOR@0.9.3.1');
api.use(['iron:router', 'templating'], 'client');
api.addFiles(['mypack.js', 'mypack.html'], 'client');
});