iron-router

Meteor 0.8.0, Iron Router and Discover Meteor

江枫思渺然 提交于 2019-11-27 07:18:26
问题 Meteor 0.8.0 is out with the new Blaze rendering, which is great... for the future. At the present I can't run my Iron Router powered app: updated -> ran meteor -> white browser screen. I guess I'll roll back to 0.7.2. but that gives me a fuzzy feeling. Its like have a new computer with no internet connection. Is there any fix for these changes? At least for Iron Router? Note Comment (although it was in the title): I am learning meteor using the Discover Meteor book, it's a great book written

How do I access HTTP POST data from meteor?

人走茶凉 提交于 2019-11-27 06:48:51
问题 I have an Iron-router route with which I would like to receive lat/lng data through an HTTP POST request. This is my attempt: Router.map(function () { this.route('serverFile', { path: '/receive/', where: 'server', action: function () { var filename = this.params.filename; resp = {'lat' : this.params.lat, 'lon' : this.params.lon}; this.response.writeHead(200, {'Content-Type': 'application/json; charset=utf-8'}); this.response.end(JSON.stringify(resp)); } }); }); But querying the server with:

Meteor: User Profile Page with Iron Router

安稳与你 提交于 2019-11-27 01:58:35
问题 I'm struggling to create a user profile page, using Iron Router, which is located at localhost:3000/:username . The profile page should have the following characteristics: Public view - anyone can see basic information about the user Private view - if the client visits his or her own profile page while signed-in, his or her sensitive user data is shown and they have edit capabilities Loading view - while the user profile data is being fetched, show a loading screen Not found view - if invalid

Meteor v 1.0 and Iron:Router

六月ゝ 毕业季﹏ 提交于 2019-11-27 01:50:14
问题 Is anyone else getting the following error from Iron-Router since upgrading Meteor to version 1.0? Please post here if you know how to resolve this issue. Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction ? Router.map(function () { Router.route('profileShow', { waitOn: function () { if (Meteor.user()) { Meteor.subscribe('userData'); } else { this.next(); } }, data: function () { if (Meteor.user()) { return {profile: Meteor.user().profile}; } } }); }); 回答1:

How to redirect after user has just logged in or just logged out

一世执手 提交于 2019-11-26 20:17:00
问题 It seems Deps.autorun is the way to go but Router.go doesn't seem to work within Deps.autorun. 回答1: Here is an example with three routes: index , signin and dashboard : Router.configure({layoutTemplate: 'layout'}); Router.map(function() { this.route('index', {path: '/'}); this.route('signin'); this.route('dashboard'); }); var mustBeSignedIn = function(pause) { if (!(Meteor.user() || Meteor.loggingIn())) { Router.go('signin'); } else { this.next(); } }; var goToDashboard = function(pause) { if

How to serve a file using iron router or meteor itself?

前提是你 提交于 2019-11-26 14:36:23
I'm trying to serve a zip file on my Meteor app but I'm stuck. After a lot of Googling it seems the best way to go is with Iron Router but I don't know how: Router.map -> @route "data", where: 'server' path: '/data/:id' action: -> data = getBase64ZipData(this.params.id) this.response.writeHead 200, { 'Content-Type': 'application/zip;base64' } ??? David Weldon On the server: var fs = Npm.require('fs'); var fail = function(response) { response.statusCode = 404; response.end(); }; var dataFile = function() { // TODO write a function to translate the id into a file path var file = fileFromId(this

How to serve a file using iron router or meteor itself?

ε祈祈猫儿з 提交于 2019-11-26 03:57:53
问题 I\'m trying to serve a zip file on my Meteor app but I\'m stuck. After a lot of Googling it seems the best way to go is with Iron Router but I don\'t know how: Router.map -> @route \"data\", where: \'server\' path: \'/data/:id\' action: -> data = getBase64ZipData(this.params.id) this.response.writeHead 200, { \'Content-Type\': \'application/zip;base64\' } ??? 回答1: On the server: var fs = Npm.require('fs'); var fail = function(response) { response.statusCode = 404; response.end(); }; var