Okay okay, not quite a bare-bones boilerplate, more of a small sample app built using Express and Backbone plus a few friends. I've called it a boilerplate because I've used it as the basis for a few bigger projects, so hope it can help others in this regard too.
Run npm install
once you've got a copy of the project.
- Can be started via
grunt start
- Can be accessed via
http://localhost:3000/client/
You can also pass the following commandline args to grunt start
:
--NODE_ENV
:production
ordevelopment
(defaults todevelopment
)--NODE_PORT
: (defaults to3000
)
e.g. grunt start --NODE_ENV=production --NODE_PORT=4000
will start the server in production mode on port 4000.
The grunt start
task will also:
- Watch the SASS files, and recompile the dev CSS if any changes are made
- Watch the client src & test JS files, and run JSHint plus the client tests if any changes are made
- Watch the server src & test JS files, and run JSHint plus the server tests if any changes are made
RequireJS is used for file and module loading. Backbone.js is the client-side MVC framework. Handlebars is used for client-side templating. Compass is used for CSS authoring.
- Can be run in the browser via
http://localhost:3000/client/test/
- Can also be run headless via
grunt test-client
- JUnit XML is output to
./_junitxml/client
A module listing the required tests to run is generated via grunt. Jasmine is used for testing the JS. CasperJS is used to drive the tests headless via PhantomJS.
- Can be run via
grunt test-server
- JUnit XML is output to
./_junitxml/server
jasmine-node is used for testing the Node server JS.
- Can be generated via
grunt docs
- Output to
./_docs
- Can be accessed via
http://localhost:3000/_docs
Docker is used to generate the client-side docs.
- Can be generated via
grunt dist
Uses the RequireJS optimiser to compress the JS. Rewrites the index.html file to only include the one script.
- @andrewpmckenzie, whose node-jasmine-dom was a big inspiration for this project
- @smozely, for the scaffolding and eventMediator suggestions
- @timsnadden, for showing me some new npm modules and Backbone helpers