Skip to content
Vincent Schramer edited this page Mar 16, 2014 · 6 revisions

Some folder structure notes

  • client - Client app for browser, html, css, etc.
  • framework - Contains primary server-side modules, such as JobController, JobRepository, JobProcessor
  • http - Modules which interface the framework modules to the HTTP protocol. You should see express apps in here.
  • models - Definition of data structures passed around.
  • util - Misc. utilities and modules.
  • module-config - Contains wired up modules for use in production. This could be replaced eventually with some sort of dependency injection mechanism in the future. Here you can find, for example, a configured express app which will respond to Job Submissions.
  • tests - Inside here are automated tests which verify that the functionality of the application is as expected.
  • stats - Contained here are some node.js scripts which calculate some statistics on the number of job submissions to mongo.

Code Conventions

Originally there was a convention to use tab indentation with Allman-style. However, this wasn't followed by all the original developers, and in hindsight was a bad idea.

Guidelines:

  • 4-space indentation
  • When writing new modules, please consider using promises; the project currently depends on Q.
  • Run the tests to at least confirm that previous functionality hasn't been broken.

Formatting Examples

function testfunc (myVar, callback) {

    var stuff = {
        value: 2
    };
    
    var sum = myVar + stuff.value;
    
    callback(sum);
}

testfunc(3, function (s) {
    console.debug(s);
});

Tests

You can run the tests using grunt test. You must install grunt globally with npm install -g grunt-cli.

Running single tests

As a suggestion to run single tests, install jasmine-node npm install -g jasmine-node and then run the following command:

jasmine-node path/to/testSpec.js --verbose --autotest --watch .

The preceding command will run the tests inside path/to/testSpec.js continuously whenever a file changes within the project.