-
1.1 Node.js: To serve be able to handle http+sockets requests.
-
1.2 Can.js: Simple, Angular like clientside MVC framework
-
1.3 Express.js: Simpliest HTTP framework for Node.js
-
1.4 {{Handlebars/mustache}} templates:
- Server side: Handlebars
- Client side: can.Stache
-
2.1 POS: Point of sale, an Android application for restaurants. They use it to print and track bills.
-
2.2 PRO: Storyous for PROffesionals. Our sales page. (pro.storyous.com)
-
2.3 WWW: Social network and magazine for foodies. (storyous.com)
-
2.4 PAY: Backend for POS system (APIs and web application).
-
2.5 WIKI: Every project is documented on it's Github wiki.
-
3.1 ES5 style like AirBNB: for the ES5-only guide click here.
-
3.2 ES5 Examples: example of class and service.
-
3.3 Can.JS pro-tips: some advices, how to use Can.js.
-
4.1 Keep git clean: We use a Gitflow workflow to manage projects on git.
- Never commit to master/alpha/beta/dev branches directly
- Each "feature" should have own branch
- Make a pull request when the work is done
-
5.1 Avoid callback hell. Keep the app clear.
- Use Promisses and Deferreds to keep an order.
- But it's not a silver bullet!
We use Q module
```javascript
publicMethod: function (foo, bar, callback) {
this.doSomethink(foo)
.then(this._nextMethod(bar))
.then(callback);
}
```
-
5.2 Keep the code simple and self descriptive: It's good to keep methods, classes and files short and self descriptive.
- keep file 500 lines max. (300 is good)
- keep methods 40 lines max. (25 is good)
- max. 4-5 arguments in method (use instance of a Class, when u need more)
- max 3-4 nested blocs (ifs/cycles/functions) in a method
-
5.3 Keep names when using require:
// bad
var service = require('./someServiceName');
var someClassName = require('./someClassName');
var mongo = require('mongodb');
// good
var someServiceName = require('./someServiceName');
var SomeClassName = require('./someClassName');
var mongodb = require('mongodb');
- 5.4 JSON does not guarantee property order in object, but MongoDB does:
db.test.update({_id: 'abc'}, {
$addToSet: {
field: {
$each: [
{a: 1, b: 2},
{b: 2, a: 1} // not the same object !!!
]
}
}
});