Rendering Your App on Server-side with Angular Universal module

Rvsairam
May 29, 2021

1.Install angular CLI this will install angular recent version CLI

$ npm install -g @angular/cli

Start new project

ng new angularseoappcd angularseoappng add @nguniversal/express-engine --clientProject <projectName>

Express server and related changes everything(config changes and express server related code)will be added to your project automatically

The server runs on the 4000 port by default and returns HTML to the browser.

$ npm run build:ssr 
$ npm run serve:ssr

SSR -> SERVER SIDE RENDERING

In general angular applications will run on a 4200 port with the help of an HTTP server that is called “CLIENT SIDE RENDERING”

but This will build your project with SSR support and start the Express server from the http://localhost:4000.

Search Engine Optimization or SEO is also supports if we use SSR rendering style.

Thank you

--

--