Define-once, run-everywhere realtime operations framework
$ npm install shipment@next
const Shipment = require('shipment');
const {Cli, HttpServer, ApiWrapper} = Shipment;
const shipment = new Shipment({
toUpper({args: {message}}) {
return message.toUpperCase();
},
});
// Expose a CLI
new Cli(shipment.cli()).run();
// $ node ./my-module.js to-upper --message bar
// Or expose an HTTP server
new HttpServer(shipment).listen();
// $ curl -X POST -d '{"message": "bar"}' http://localhost:6565/to-upper
// Or simply a Node.js module
module.exports = new ApiWrapper(shipment).proxy;
// console.log(require('./my-module.js').toUpper({message: "bar"}));
MIT © sgtlambda