peat
v0.1.4
Published
response part objects for Oban
Downloads
728
Maintainers
Readme
Peat
The classes that Oban) uses for responses. require
this in your route modules, and Oban in your server module.
npm install peat
API
Part
Common base class. Extend it, don't use it.
Status(code)
Tells Oban to set the HTTP status.
Header(name, value)
Tells Oban to set an HTTP header.
Extending
So you want to extend Peat? Good for you! Just grab a reference to Part
, subclass it using your favourite method, and give it a useful run
method. Let's say you want to add a Timeout
part that calls res.setTimeout
:
var Timeout = Estira.extend.call(Part, {
initialize: function(timeout) {
this.timeout = timeout;
},
run: function(res) {
res.setTimeout(this.timeout);
}
});
Licence
MIT.