Angular server side rendering. What did i learn?
I have finished an angular application full support server side rendering. I write some notes for this. Detail will be explained in next article.
You can check sample app here.
MEET@SAIGON is an all free service which helps you to make any public or private event announcements and to manage…event-ssr.herokuapp.com
- Make an angular app can render from server side is not easy. You must care to many things. Ex: which library can use in server side? Call API twice..
Tip: use webpack to replace unsupported module. Below is my sample code for replace quill editor.
2. All code inside lifecycle of component will run two times. Ex: generate UI, call service …
Tip: Use ServerTransferStateModule for re-use state from server. You can refer this for good advice.
3. Should use resolve to fetching data before render router.
Need a node.js server for server side. Can use heroku, AWS lambda, google cloud function…
5. Be careful when use ES8 features on node.js. Check this more detail
6. isPlatformBrowser() , isPlatformServer() are useful functions.