Giter VIP home page Giter VIP logo

angular-v5-ssr-pwa-template's Introduction

Angular v5 SSR and PWA template

Prerequisites

  • node.js ( stable version )
  • @angular/cli@latest ( 1.5.0 )
  • @angular v5
"dependencies": {
  "@angular/platform-server": "^5.0.0"
  "@nguniversal/express-engine": "5.0.0-beta.5"
  "@nguniversal/module-map-ngfactory-loader": "5.0.0-beta.5"
  "ts-loader": "^3.1.1"
},
"devDependencies": {
  "sw-precache-webpack-plugin": "^0.11.4"
}

Try it out!

  • clone this repository
  • run and build the commands
  • use http-server for the service-worker.js to load

Production Build and Serve

  • normal: ng build or ng build --prod or ng build --prod --build-optimizer

  • normal: ng serve --aot

  • server side rendered: npm run build:universal

  • generate service worker: npm run pwa

  • serving server side rendered: npm run serve:universal

"scripts": {
  "...": "..."
  "build:universal": "npm run build:client-and-server-bundles && npm run webpack:server",
  "serve:universal": "node dist/server.js",
  "build:client-and-server-bundles": "ng build --prod --build-optimizer && ng build --prod --build-optimizer --app 1 --output-hashing=false",
  "webpack:server": "webpack --config webpack.server.config.js --progress --colors",
  "pwa": "sw-precache --root=dist/browser --config=precache-config.js",
  "pwa:dev": "ng build --prod && sw-precache --root=dist --config=precache-config.js"
}

Running on http-server

  • npm install http-server
  • http-server --https --cors <path-of-index.html>
  • open http://127.0.0.1:8080

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.

Reference

angular-v5-ssr-pwa-template's People

Contributors

angular-cli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.