项目作者: guahanweb

项目描述 :
Boilerplate for applications using docker, node, hapi, webpack and sass
高级语言: JavaScript
项目地址: git://github.com/guahanweb/docker-node-boilerplate.git
创建时间: 2017-06-29T15:31:58Z
项目社区:https://github.com/guahanweb/docker-node-boilerplate

开源协议:

下载


Docker Node Boilerplate

This project contains all the necessary components to build a well structured, scalable application quickly. By leveraging tooling like Hapi, React, Mocha and Supertest, you can have a fully functional docker image build to host your web application or service in a matter of minutes.

Getting Started

With Docker

  1. Install Docker for Mac or Windows
  2. Clone the repository
  3. Build and run your image:
  1. $ cd docker-node-boilerplate
  2. $ ./build
  3. $ docker run -i \
  4. -p 4118:4118 \
  5. -t guahanweb/docker-node-boilerplate:$(cat version)

Without Docker

  1. Clone the repository
  2. Build and run the app:
  1. $ cd docker-node-boilerplate/app
  2. $ npm run setup
  3. $ npm run dev
  4. [info] listening at http://localhost:4118

Test your endpoints

Whether you’re running on docker or not, both the previous methods will expose the running port on localhost for you. Navigate to the /ping or /service-status endpoint to verify you are up and running:

  • Ping: http://localhost:4118/ping
  • Service status: http://localhost:4118/service-status?v&h

Default NPM scripts

While it is encouraged that you customize your project and tune the scripts to your style, the following scripts are available “out-of-the-box” with this boilerplate.

npm run dev - development mode

Starts up your app with nodemon and watch for either server or client changes, building assets or restarting the service as necessary.

npm start - production mode

Starts up your app directly in production mode.
This is the equivalent of running the following:

  1. $ NODE_ENV=production node --harmony app/server

npm test

Runs both sets of tests:

  • :client - mocha tests defined in app/test/client
  • :server - mocha tests defined in app/test/server

Executes mocha tests on the app/test/server directory.

npm run build

Builds all necessary static assets for your web application.

  • Assets - copies everything from app/client/assets into dist
  • CSS - builds SCSS files into dist/css
  • JS - uses Webpack to build artifacts into dist/js

npm run watch

Builds all necessary static assets for web application from npm run build and watches them, rebuilding when they are altered.

TODO: connect to browser-sync for live reload (or React hot module swap)