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.
$ cd docker-node-boilerplate
$ ./build
$ docker run -i \
-p 4118:4118 \
-t guahanweb/docker-node-boilerplate:$(cat version)
- Clone the repository
- Build and run the app:
$ cd docker-node-boilerplate/app
$ npm run setup
$ npm run dev
[info] listening at http://localhost:4118
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
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.
Starts up your app with nodemon
and watch for either server or client changes, building assets or restarting the service as necessary.
Starts up your app directly in production mode. This is the equivalent of running the following:
$ NODE_ENV=production node --harmony app/server
Runs both sets of tests:
:client
- mocha tests defined inapp/test/client
:server
- mocha tests defined inapp/test/server
Executes mocha tests on the app/test/server
directory.
Builds all necessary static assets for your web application.
- Assets - copies everything from
app/client/assets
intodist
- CSS - builds SCSS files into
dist/css
- JS - uses Webpack to build artifacts into
dist/js
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)