3

I would appreciate if someone could clarify if it is necessary for hosting server to have node.js support in order for Angular Universal to work. And will I need to upload both browser and server folder in dist to the hosting. If yes, any recommendations on hosting a which offer such support? Secondly is there another way apart from node.js to make server side rendering to work?

2
  • Why do you want to avoid Node.js? Commented May 21, 2021 at 0:30
  • You should be able to run npm run prerender and upload the output of the dist folder to your http webserver or webserver that only supports whatever backend you're using. However you won't be able to have variable data on your components Commented Dec 13, 2021 at 20:37

1 Answer 1

3

Before answering this question, lets understand some basics of SSR and CSR in a layman language.

CSR or Client-side rendered

When a web-application gets rendered on the browser (Client-side). Here browser downloads all the html css and js first. Than the JS(your-some-awesome-framework) runs on browser and decide how the final webpage will look and act.

SSR Server-side Rendering

When a web-application gets rendered on the server (Server-side). Here the JS(your-some-awesome-framework) does most of its work on server already. So on your browser you gets the webpage without any delay of your JS booting and binding and rendering.


Now there are two types of rendering -

Dynamic SSR and Static Pre-rendering SSR

Dynamic SSR when a live server dynamically generate and serialize the application. When a user hit a URL of website , the server first generates the webpage and serve the content.

Static Pre-rendering SSR when there is already a pre-rendered static files and the browser simple serve those files.


Now comes the answers to your question in regard to angular framework.

  1. Is it necessary for hosting server to have node.js support in order for Angular Universal to work ?

For Static Pre-rendering SSR - NO, there is no such need.

For Dynamic SSR - technically Yes, see below

  1. And will I need to upload both browser and server folder in dist to the hosting ?

For Static Pre-rendering SSR - browser folder on any server which can host files

For Dynamic SSR - server folder on a nodeJs support server.

  1. is there another way apart from node.js to make server side rendering to work?

There are some ways to run node through ASP.NET Core and other options too. But for dynamic ssr nodeJs will come the the way.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.