2016-09-01 16 views
0

メーターキッチンをサーバー側でレンダリングする方法はありますか?流星キッチンのサーバー側レンダリング

現在、すべてjavascriptでレンダリングされていますが、REST APIを作成する予定であるため、サーバー側のレンダリングが必要です。

答えて

0

meteorhacks:ssr + iron:routerを使用してサーバー側のレンダリングを行うことができます。サーバー側で鉄道ルートを作成し、次にブレーズテンプレートをレンダリングします。ここにルート例があります。

this.route('home', { 
    where: 'server, 
    path: '/', 
    action: function() { 
     var templateData = {}; 
     var html = SSR.render('templateName', templateData); 
     this.response.writeHead(200, {'Content-Type': 'text/html'}); 
     this.response.write(html); 
     this.response.end(); 
    } 
}); 

このメソッドを使用して、SEOの静的ページをhttps://gameraven.com/に配信しています。

+0

デリックに返信いただきありがとうございますが、このコードはどこにあるのですか? – chulian

+0

そのコードはserver/main.jsに入ります 両方のパッケージのドキュメントを読むことをお勧めします。 https://github.com/iron-meteor/iron-routerと https://github.com/meteorhacks/meteor-ssr –

関連する問題