asotog
asotog

Reputation: 225

What's the main purpose of platform-server module in Angular 2?

When looking AOT (ahead of time compilation) docs https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#compile , there is a dependency on platform-server , what is the purpose of it ? seems only compiler-cli required to run the compiler tool

Upvotes: 13

Views: 10454

Answers (2)

Mahmood Sajjadi
Mahmood Sajjadi

Reputation: 420

This question is related to Angular V2 but now Angular V4.0.0 Almost release (in the time of writing it is in RC-3) and @Angular/platform-server changed a lot

So Just for the reference

based on this link: https://github.com/angular/angular/issues/13822

some part of Angular Universal(API part) is merged to @angular/Core some another part is now rewritten with the name of @angular/platform-server

an as @mikezks mentioned on that topic https://github.com/angular/angular/issues/13822#issuecomment-286742244 all the magic is renderModuleFactory (that is the whole magic behind SSR).

so from now: @angular/platfomr-server is for server side rendering of Angular and generating HTML pages(in NodeJS)

Upvotes: 7

Ha Hoang
Ha Hoang

Reputation: 1684

The @angular/platform-server provides the server platform that supports the runtime compiler and it only as a dependency of compiler-cli. In the future, we will be installing compiler-cli that don't need it as here.

Upvotes: 15

Related Questions