Skip to content

Angular 7 Universal starter kit based on @angular/cli featuring Server-Side Rendering (SSR) and HMR on browser/server sides

Notifications You must be signed in to change notification settings

vineethtrv/angular-universal

 
 

Repository files navigation

Universal Angular Application

This project was generated with Angular CLI version 7.1.0.

Demo

Live Demo is running on now.sh.

About

This starter kit contains all the minimal tooling and configuration you need to kick off your next universal Angular 7 project.

It combines @angular/cli and udk to won't have to write specific code for development purposes only.

Features

Important: HMR doesn't work yet on server side with lazy routes (but works in browser side). We are trying to find a way which fixes this issue and we're still opened for possible solutions.

Getting started

git clone https://github.com/enten/angular-universal my-project
cd my-project
npm install
npm start

Branches

Branch material

Preview of branch material
git clone https://github.com/enten/angular-universal -b material my-project
cd my-project
npm install
npm start

Branch toh

Preview of branch toh
git clone https://github.com/enten/angular-universal -b toh my-project
cd my-project
npm install
npm start

Branch i18n

Preview of branch i18n
git clone https://github.com/enten/angular-universal -b i18n my-project
cd my-project
npm install
npm run start:fr

Development server

Two different dev servers are provided:

  • The universal dev server which enable SSR (build browser and server targets) ;
  • The SPA dev server which is a webpack dev server (build browser target only).

SPA dev server can be useless (or "broken"): it depends on your server implementation.

Universal dev server

Run npm run dev (or npx ng-udkc) for an universal dev server. Navigate to http://localhost:4000/.

The app will automatically hot-reload on server and browser sides if you change any of the source files.

The server will automatically restart if a change occured in metafiles and metadirs defined in udk.container.js.

Universal dev server with ng-udkc

SPA dev server

Run npm run dev:spa (or npx ng serve --hmr) for a SPA dev server Navigate to http://localhost:4200/.

The app will automatically reload if you change any of the browser source files.

Note: the universal dev server provide an SPA mode too if you navigate to the index.html: http://localhost:4000/index.html.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run npm run build to build the project. The build artifacts will be stored in the dist/app directory.

Run npm run build:prod for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

About

Angular 7 Universal starter kit based on @angular/cli featuring Server-Side Rendering (SSR) and HMR on browser/server sides

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 70.0%
  • JavaScript 22.2%
  • HTML 7.4%
  • CSS 0.4%