Jordan Kasper | @jakerella
// math.js
module.exports = function add(x, y) {
return x + y;
};
// index.js
var addNumbers = require('math');
addNumbers(6, 7); // 13
function add(x, y) { return x + y; }
function subtract(x, y) { return x - y; }
module.exports = {
add: add,
subtract: subtract
};
// index.js
var mathApi = require('math');
mathApi.add(6, 7); // 13
module.exports = function myApi(option) {
// inspect options, build API methods...
return {
methodOne: function() { ... },
methodTwo: function() { ... }
};
};
var express = require('express');
var app = express();
app.set('port', 3000);
training.strongloop.com/intro-to-loopback (PDF)
StrongLoop Documentation: docs.strongloop.com
Jordan Kasper | @jakerella