nwb-react-tutorial
August 9, 2016 ยท View on GitHub
An implementation of the comment box from the React tutorial using nwb's middleware in the tutorial's API server to take advantage of nwb's default development setup, including:
- ES6
classcomponents, shorthand properties, arrow functions, computed property names, module syntax, spread operator - Stage 2 class properties
- Stage 3
async/awaitsyntax fetch()andPromisepolyfills- Importing CSS
- Creation of final HTML to serve built files
- Deterministic filename hashing for long-term caching of built files
Prerequisites
Node.js >= v4 must be installed.
Installation
- Running
npm installin the app's root directory will install everything you need for development.
Development Server
-
npm startwill run the app's server at http://localhost:3000.If a static build is present in
dist/, it will be served.Otherwise, a hot-reloading development build will be served using nwb's middleware.
-
npm run buildcreates a static production build by default.To create a static development build, set the
NODE_ENVenvironment variable todevelopmentwhile building. -
npm run cleanwill delete built resources fromdist/.