문제

I've recently started learning node and trying to build an application. I was reading about on which end it's better to render for a single page app.

It's better to render on backend because of faster initial load, and better seo

It's better to render on front end, because with frameworks like ember, backbone, angular you can bind variables and easily update them without going through the DOM too much.

I've came to the conclusion to try hybrid way(initial on backend, and update on front). Are there some solid frameworks for that ?

도움이 되었습니까?

해결책

  • Rendr from AirBnB is based mostly on backbone and backbone-style design choices
  • Ezel from Artsy is also backbone-based. Blog post announcing Ezel
  • flatiron from Nodejitsu uses the plates templating library which runs in both node.js and the browser
  • Derby runs in both node.js and the browser

At the moment just for completeness I will note that Meteor and AngularJS are currently browser-only. I suspect both projects will have some server-side rendering options perhaps later in 2014 though.

다른 팁

You are right with your assumption, that a hybrid approach seems to be the golden way as it combines the advantages (snappyness, dynamics, offline readyness) of client side generated UIs with the advantages of server side rendered UIs (mainly page buildup speed). That's why Twitter migrated from a client-side JavaScript approach back to server-rendered content [1].

Ember JS will soon introduce a feature called FastBoot [2] which allows to build a hyrid approach to page rendering as you requested. I'm not aware of any other framework which inherently supports this. Of course, you can always spin up a headless browser like PhantomJS to render on the server side but transparently transitioning to a client side mode is uncharted territory.

[1] https://blog.twitter.com/2012/improving-performance-on-twittercom

[2] http://emberjs.com/blog/2015/01/08/inside-fastboot-faking-the-dom-in-node.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top