简体   繁体   English

服务器端路由与服务器端呈现/同构javascript相同吗?

[英]Is server side routing the same as server side rendering / isomorphic javascript?

I'm struggling to see the difference between server side routing and redirecting in it and server side rendering / isomorphic javascript. 我很难看到服务器端路由和重定向在它与服务器端渲染/同构javascript之间的区别。 How are they different, if they are different. 如果它们不同,它们有何不同。

Universal (Isomorphic) Javascript can execute both on the client and the server and share the application state between the two sides. 通用 (同构)Javascript既可以在客户端和服务器上执行,也可以共享双方之间的应用程序状态。 It means that the application uses the same rendering engine on the client and the server. 这意味着应用程序在客户端和服务器上使用相同的呈现引擎。 The point of it is that the client should continue from the point where the server finished its job. 重点是客户端应该从服务器完成其工作的位置继续。

Main advantages: 主要优点:

  • SEO SEO
  • performance 性能

On the other hand we have the old way of dealing with SPA (single-page applications). 另一方面,我们有处理SPA(单页面应用程序)的旧方法。 It runs entirely in the browser and the server is asked for data only. 它完全在浏览器中运行,并且仅向服务器请求数据。

This might seem like a clean and nice separation of concerns, While this can lead to a nice, clean separation of concerns, unavoidably some parts of application logic or view logic are being duplicated in both the server and the client (usually in different languages). 这似乎是一个干净而美观的关注点分离,虽然这可以导致关注点的良好,清晰的分离,但不可避免地,应用程序逻辑或视图逻辑的某些部分在服务器和客户端中都被复制(通常使用不同的语言) 。

In addition application that is running only in client-side is not able to serve HTML to users or crawlers. 此外,仅在客户端运行的应用程序无法向用户或爬网程序提供HTML。 This decreases the performance of the initial page load and also it's more difficult to deal with SEO. 这降低了初始页面加载的性能,并且处理SEO也更加困难。


Sources : 资料来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM