The smallest service looks like this (located at lib/services/FooService.js):

extend(true, exports, Logging.prototype);
exports.logging_prefix = 'FooService'; 

exports.doReturnTwo = function() {
    return 2
};

Usage is like that:

var foo_service = service_manager.get('Foo');
foo_service.doReturnTwo();

You may not be fimilar with this folder structure and the exports global within modules, but this is how the commonjs module structure is. To make your cold work great in whatever environment it's a good idea to keep the services as a valid CommonJS module.

Comments