iron:router meteor
Router.route('/', function () {
this.render('MyTemplate');
});
Router.route('/items', function () {
this.render('Items');
});
Router.route('/items/:_id', function () {
var item = Items.findOne({_id: this.params._id});
this.render('ShowItem', {data: item});
});
Router.route('/files/:filename', function () {
this.response.end('hi from the server\n');
}, {where: 'server'});
Router.route('/restful', {where: 'server'})
.get(function () {
this.response.end('get request\n');
})
.post(function () {
this.response.end('post request\n');
});
Are there any code examples left?
New code examples in category Javascript