iron 3arouter meteor

Solutions on MaxInterview for iron 3arouter meteor by the best coders in the world

showing results for - "iron 3arouter meteor"
Giorgio
25 Jan 2019
1Router.route('/', function () {
2  this.render('MyTemplate');
3});
4
5Router.route('/items', function () {
6  this.render('Items');
7});
8
9Router.route('/items/:_id', function () {
10  var item = Items.findOne({_id: this.params._id});
11  this.render('ShowItem', {data: item});
12});
13
14Router.route('/files/:filename', function () {
15  this.response.end('hi from the server\n');
16}, {where: 'server'});
17
18Router.route('/restful', {where: 'server'})
19  .get(function () {
20    this.response.end('get request\n');
21  })
22  .post(function () {
23    this.response.end('post request\n');
24  });