express-like organization for command-line applications.
$ npm install hoagie --save
// math.js
var hoagie = require('hoagie');
var app = hoagie();
app.use('add', function(req, res, next) {
var a = parseInt(req.params[1], 10);
var b = parseInt(req.params[2], 10);
res.send(a + b);
});
app.run(hoagie.argv);
$ node ./math.js add 1 1
2
See the examples
directory for more code samples.
Adds each middleware function to the stack, optionally under the command
space. Each middleware should be a function of the signature function(req, res, next)
.
- hoagie-session adds "session" support
- hoagie-exec Make your hoagie program exec to another process