PID | COMMAND | %CPU | TIME | #PORTS | MEM |
---|---|---|---|---|---|
35084 | node | 2.2 | 19:55.75 | 29 | 73M+ |
'use strict';
const Seneca = require('./');
const seneca = Seneca();
seneca.add({ cmd: 'config' }, function (args, callback) {
callback(null, { value: 2 });
});
seneca.add({ cmd: 'salestax' }, function (args, callback) {
seneca.act({ cmd: 'config' }, function (err, result) {
if (err) {
return callback(err, null);
}
callback(null, { total: (args.net * result.value) })
});
});
seneca.listen({
type: 'http',
port: 10002
});
'use strict';
const Seneca = require('./');
const seneca = Seneca();
const act = function () {
seneca.act({ cmd: 'salestax', net: 2 }, function (err, result) {
setTimeout(act, 50);
});
};
seneca.ready(act);
seneca.client({
type: 'http',
port: 10002
});
service:
$ node --max-old-space-size=100 service.js
client:
$ node client.js
node version:
$ node --version
v4.2.4