Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 Universal - Server-side Rendering

Tags:

angular

I was reading about Angular 2 Server side rendering with node.

But I cannot find an example or explain how should I do that. I need to render some pages with angular from server, any advice?

like image 941
Pablo Avatar asked Jan 20 '16 16:01

Pablo


4 Answers

Well, look at this starter kit https://github.com/alexpods/angular2-universal-starter. It has server side rendering, web workers support (entire angular2 application is running in a web worker) , lazy loading (using webpack's code splitting) and many other things. I hope it will help you.

Disclosure: I'm its author.

like image 176
alexpods Avatar answered Oct 03 '22 19:10

alexpods


This is the example the creators of angular-universal used in their talk, its a working repo -> https://github.com/angular/universal-starter/tree/angular-connect

And this is the talk - Full Stack Angular 2

like image 32
Angular University Avatar answered Oct 03 '22 19:10

Angular University


Take a look here: https://universal.angular.io/

Looks like 'some' of the official documentation/site is now up. API docs are in the code but for quick reference see these links:

https://universal.angular.io/api/universal/index.html#typedoc-main-index https://universal.angular.io/api/preboot/globals.html

Nice third party overview and setup doc: https://mickaelkerjeanblog.wordpress.com/2016/05/02/angular-universal/

like image 5
Corey S. Avatar answered Oct 03 '22 18:10

Corey S.


There's another example repo at https://github.com/ng-seed/universal showcasing both Universal and lean Angular on a single project.

This application uses platform-server delivered with Angular 4.0.0, and it could be a good starter/seed project until Angular provides some documentation about the use of platform-server.

Furthermore, it covers most of the features of angular2-webpack-starter by AngularClass such as async/lazy routes, SCSS compilation (both inline and external), dev/prod modes, AoT compilation via @ngtools/webpack, tests, TsLint/Codelyzer, @types and maybe more.

Disclosure: I'm the author too :)

like image 4
Burak Tasci Avatar answered Oct 03 '22 20:10

Burak Tasci