Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Caolan McMahon committed Jun 30, 2010
1 parent 0c5fd50 commit 5a86e6e
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# quickresponse
# quip

An exploration of a chainable API for response objects in node.

Expand All @@ -8,23 +8,28 @@ An exploration of a chainable API for response objects in node.

## Examples

// responding with different status codes
#### responding with different status codes

res.ok('<h1>Hello World!</h1>');
res.notFound('Not found');

// responding with different mime types
#### responding with different mime types

res.text('plain text');
res.json({'stringify': 'this object'});

// chaining the two together
#### chaining the two together (in any order)

res.error().json({error: 'something broke'});
res.xml().ok('<test></test>');
res.xml().badRequest('<test></test>');

#### redirection

// redirection
res.moved('http://permanent/new/location');
res.redirect('http://temporary/new/location');

// custom headers
#### custom headers

res.headers({'custom': 'header'}).text('some data');

The response is completed when data is passed to a status code or mime-type
Expand All @@ -36,22 +41,22 @@ function, or when a redirect is performed.
As a [Connect](http://github.com/extjs/Connect) filter:

var Connect = require('connect'),
quickresponse = require('quickresponse'),
quip = require('quip'),

Connect.createServer(
quickresponse.filter(),
quip.filter(),
function(req, res, next){
res.ok('test');
}
).listen(8080);

Standalone, without Connect:

var quickresponse = require('quickresponse'),
var quip = require('quip'),
http = require('http');

http.createServer(function(req, res){
quickresponse.update(res);
quip.update(res);
res.ok('test');
});

Expand Down

0 comments on commit 5a86e6e

Please sign in to comment.