A starting point for node.js based apps. Uses Docker to setup a node.js, mysql, and redis server. Webpack is used to bundle the client JS.
You need docker installed
You should change the SESSION_SECRET
and update the app and mysql ports if they are going to conflict with any of your existing services
A node.js server, mysql database, and redis service will be started. The node server will auto restart after crashing or when changes are made to /app/server
$ cd /this/dir
$ docker-compose up
If all goes as planned, you should see this message:
App running: localhost:8080
port may be different if you canged it in
.env
Webpack will be used to watch the files in /app/client
and rebuild them.
$ cd app
$ npm run dev
The webpack bundler should be run from within the docker container. The
dev
script is setup to do that
Some commands for developing
docker-compose up
- start the appdocker-compose down
- end the appnpm run dev
- watch for client changes and rebuildnpm run install
- install missing/new JS dependenciesnpm run cd-server
- "change directory" to the node server
jQuery
is imported by Backbone.js even though its not a hard dependency. Because of this,
webpack complains if we dont have jQuery. To get around this, client/jquery.js
was created
that only includes the absolute minimum
Keeping the client code slim and fast is important. An analyzer has been setup as part of the initial webpack build so we can analyze what code oversized.
It can be accessed from the root: localhost:8080/bundle-report.html