A simple starter for Angular Universal using Angular CLI
git clone https://github.com/m98/universal-cli-starter.git
In the cloned directory, run:
npm install
ng serve
: Angular CLI serve commandng build --prod
: Angular CLI production build commandnpm run build:universal
: Build the client and server application. For running the server, open thedist
directory (cd dist
) and run theserver.js
by usingnode server.js
, it will serve the application onlocalhost:8000
npm run serve:universal
: first build the client and server application, then runs it.
To learn how to add server-side rendering support to your application, read this tutorial on Medium