私のアプリは完全にローカルで機能します。ただし、それを展開すると、コレクションの投稿がアクセスされると想定されるページの javascript コンソールに次のエラーが表示されます。
Exception from Deps recompute: ReferenceError: Posts is not defined
at Object.route.data.posts
これは私が使用しているルーターのjavascriptファイルで、デプロイ時にロードされないテンプレートpostsListsに投稿を渡します。
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
waitOn: function() { console.log('waiting'); return [Meteor.subscribe('posts'), Meteor.subscribe('files')]; }
});
Router.map(function(){
this.route('postPage', {
path:'/posts/:_id',
data: function() {return Posts.findOne(this.params._id); }
});
this.route('welcome', {path: '/'});
this.route('postsList', {path: '/List',
data: {
posts: function () {
return Posts.find({}, {sort: {submitted: -1}});
}
}});
this.route('postSubmit',{
path:'/submit'
});
this.route('yourPosts',{
path:'/yourposts'
});
this.route('officialPosts',{
path:'/featured'
});
this.route('postEdit', {
path: '/posts/:_id/edit',
data: function() { return Posts.findOne(this.params._id); }
});
});
var requireLogin = function(){
if(! Meteor.user()){
this.render('accessDenied');
this.stop();
}
};
Router.before(requireLogin, {only: ['postSubmit','postsList','yourPosts','officialPosts','postEdit']});
このサイトには、 fed.meteor.comからもアクセスできます。
前もって感謝します。