What is server side rendering using angular2?

I know that angular2 is used for server-side rendering. Therefore, I would like to know more about this.

I have the following questions regarding this phenomenon.

1. What is server side rendering?

2. What problem does he solve?

3. What are its applications?

4.why side rendering used?

5. What are the technologies that support server-side rendering?

6.in angular2, what goals does server rendering help accomplish?

7. What are the main differences between client-server and server-side rendering?

8. What tools or frameworks can be used for server-side rendering?

Thanks to everyone in advance.

+7
angular serverside-rendering
source share
3 answers

Angular2 is a client library, and it is not used for server-side rendering. There is, however, an Angular Universal project that allows the server to process angular code and templates.

1. In general, on the server side, Rendering / SSR / means using the server to create content that can be used by the browser (or other clients).

2. When using single-page applications / SPA /, such as Angular2 applications, one of the biggest problems is the bootstrap. Protected areas should download all scripts of suppliers and applications (possibly download content from a database), process the content, and finally visualize it. This can take a lot of time, so the idea is that you use the SSR to create or “preview” the start page.

3. It is used because servers are faster than clients, so it can be a big performance boost for applications. It is also useful to use search engine robots - when they request a page of your site without an SSR, they will only see a blank page without any content (some search engines will load and execute your scripts).

4. angular Universal runs on nodejs servers. I believe that there is a version for PHP, but it is very fresh (in alpha, I think ...)

5. / 6. see above.

+6
source share

1) Server-side processing visualizes the views already on the server before it is delivered to the client. This means that things like data binding expressions are already allowed on the server, and the resulting HTML is delivered to the client, so it can be immediately displayed by the browser instead of executing JS first.

2) - faster time from loading to cam display
- SEO

3) see 2)

4) - Angular2
- Respond AFAIK
- perhaps many others.

5) see 2

6) the previous one displays on the server, later on the client: p To be able to render on the client, the code needs the browser abstraction, and the server code needs to generate HTML, as would be done by the browser. In Angular, this is done in a completely abstract browser (it also simplifies the launch of the application in WebWorker, because there is also no (or only limited) access to the browser API)

+4
source share

Although the question is addressed twice and beautifully, I just wanted to add a few things for the user who is still coming to him.

  • SSR addresses the abstraction widely and provides faster and more secure content delivery to the browser.

  • Things like State \ Session management, user account management, passwords \ tokens used for web services, details about a payment gateway are what you would like to avoid on the browser \ client side.

  • Main technologies \ framework for solving this problem: MEAN.IO MEAN.JS, express.js, nodes.js, meteor.js

  • If you are from the .net world, MVC is best for maintaining a well-planned structure.

Hope this makes the light easier.

Danke.

0
source share

All Articles