How to add server rendering in Angular Universal project

Help me please to understand how to use server rendering in Angular Universal.

What I've done. I visited Angular Universal official site. Setup Node.js. Downloaded recommended project Angular 2 Webpack Starter. I'm working on Mac so use "> sudo npm install" to install node_modules. Add server.js as recommended. Run "> node server.js" - however it doesn't work.

If I run "> npm start" the server starts on localhost:3000 - but it seems there are no server rendering. If I look at HTML-page there are only Angular's index.html.

What should I do to add the server rendering capabilities in the project?

Thanks a lot.


easy way is clone source code of below link and read documentation of how to run project github angular universal

scotch.io


Meanwhile, you can have a look on this example app (Angular 4.0.0, Universal support, Webpack, and a little more) https://github.com/ng-seed/universal

Will definitely give you more or less an idea about how to get it running.


I found a solution. I have downloaded a good starting project at github.com/angular/universal-starter with server rendering support.

链接地址: http://www.djcxy.com/p/5296.html

上一篇: 的node.js

下一篇: 如何在Angular Universal项目中添加服务器渲染