iron-router

Iron Router Server Side Routing callback doesn't work

独自空忆成欢 提交于 2019-12-13 00:47:07
问题 I am newer for IronRouter, why readFile callback executed the response are send to client. Router.map( ()-> this.route 'readFile', path: '/readFile' where: 'server' method: 'GET' action: ()-> self = this fs.readFile '/tmp/a.txt', (err, data)-> if err throw err console.log(data.toString()) self.response.writeHead(200, {'Content-Type': 'text/plain'}) self.response.end(data) console.log('response ...') ) http.js:733 W2049-12:04:26.781(8)? (STDERR) throw new Error('Can\'t render headers after

Meteor crashes with error: No version 0.9.1 of package iron-router was found

和自甴很熟 提交于 2019-12-12 13:18:20
问题 Running Meteor 0.8.3, haven't worked on my project since Monday. Today I can't start Meteor nor use Meteorite package manager: /usr/local/bin/mrt run Stand back while Meteorite does its thing smart.json changed.. installing from smart.json /usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:63 throw('No version ' + version + ' of package ' + self.name + ' was found ^ No version 0.9.1 of package iron-router was found in the atmosphere database Process finished with exit code 8 I

meteor with mrt - iron:router: no such package

岁酱吖の 提交于 2019-12-12 12:15:27
问题 I'm learning meteor 0.8.3 and trying to get some basic routing set up using iron-router My smart.json contains: { packages: { iron-router: { git: https://github.com/EventedMind/iron-router.git, branch: blaze-integration } } } I added this, and then ran mrt install and mrt update Then I did this, and got this error: $ meteor add iron:router iron-router: updating npm dependencies -- connect... iron:router: no such package I'm still able to run the application with mrt , and the application

How do you go to the previous route in iron-router?

家住魔仙堡 提交于 2019-12-12 10:57:13
问题 I'm using an event handler to go to the previous URL/route: 'click #back': -> history.back() This works in Chrome desktop, Chrome devtools mobile device view, and in Safari on a physical device itself (iOS 8.1.2), but not in Chrome on the device. Behavior is: Load / Click link to /foo URL changes to /foo, and foo template renders Click #back URL changes to / briefly, then changes back to /foo. The page body does not change. (Correct behavior is the URL permanently changes to /, and the /

Meteor - Publish just the count for a collection

荒凉一梦 提交于 2019-12-12 08:25:22
问题 Is it possible to publish just the count for a collection to the user? I want to display the total count on the homepage, but not pass all the data to the user. This is what I tried but it does not work: Meteor.publish('task-count', function () { return Tasks.find().count(); }); this.route('home', { path: '/', waitOn: function () { return Meteor.subscribe('task-count'); } }); When I try this I get an endless loading animation. 回答1: Meteor.publish functions should return cursors, but here you

Using onResetPasswordLink, onEnrollmentLink, and onEmailVerificationLink methods properly in Meteor

孤者浪人 提交于 2019-12-12 07:57:24
问题 I was wondering if someone would be kind enough to provide a meteorpad or code example of using one of the methods listed above properly in Meteor (with iron:router). I'm struggling to understand how exactly these methods interact with my app, and it seems these methods are new enough that there isn't much good documentation on how to use them correctly. Thanks! http://docs.meteor.com/#/full/Accounts-onResetPasswordLink 回答1: Ok, so I am going to post what I ended up learning and doing here so

Getting Facebook Avatar in Meteor when Autopublish is removed

十年热恋 提交于 2019-12-12 06:19:22
问题 Currently when auto publish is removed, only {{currentUser.profile.name}} works.I'm trying to get {{currentUser.profile.first_name}} and the avatar from Facebook but have not been able to do so. Here is my code... On the Server side: Meteor.publish('userData', function() { if(!this.userId) return null; return Meteor.users.find(this.userId, {fields: { 'services.facebook': 1 }}); }); On Iron Router: Router.configure({ waitOn: function() { return Meteor.subscribe('userData'); } }); From my

How can I make Meteor templates available to targeted audiences via an URL?

 ̄綄美尐妖づ 提交于 2019-12-12 05:42:06
问题 I want to build a Blog, of sorts, with Meteor but, rather than just have a Blog such as platypus.meteor.com, I want to create a separate Meteor template for each Blog "post" and then send a link to select people such as "platypus.meteor.com/thispost" In this way, the person would only see the post I intend them to see; to see others, they would have to guess at other values, such as "/thatpost", "/theotherpost" etc. And in my case, if they stumbled across them, no big deal. This is my plan:

Iron Router: Pass data to client via meteor method

天大地大妈咪最大 提交于 2019-12-12 04:45:44
问题 My application uses iron router: When a user hits a certain route that contains a wildcard, I would like to use the value of the wildcard to call a meteor method and have its return value be used to set the data context for the template. Example: Meteor method: getUserName: function(id){ return Meteor.users.findOne({_id: id}).profile.name; } Router: data: function(){ Meteor.call('getUserName', this.params.userId, function(error, result){ }); } The meteor method returns the correct value and I

Meteor template data context not available in template.created upon refresh

大城市里の小女人 提交于 2019-12-12 04:37:01
问题 I use the template data context inside a template's created function. Template.temp.created = function() { console.log('this.data'); }; When I go to the page normally--i.e. click the link to the page--I see the console log the correct data object. When I hit the refresh button on the page, this.data is null . Why? Also, I am using iron-router to set the data context: ... this.route('temp', { ... data: function() { return MyCollection.findOne(someId); }, ... } ... 回答1: If you want to wait