0.3.0 • Published 9 years ago

respondjs v0.3.0

Weekly downloads
56
License
MIT
Repository
github
Last release
9 years ago

RespondJS

respondjs is a simple package for defining format-based HTTP responses. It is inspired by the ´respond_to´ rails function. You can define a callback for any response MIME format. The respondjs module will select the appropriate response format by checking the req.params.format value and the HTTP Accept header respectively. After a format has been chosen, the callback registered for that format will be called.

var app = require("express")();
var respond = require("respondjs");

var response = respond().to("text", function(req, res, format) { res.send("hello world"); })
       .json(function(req, res, format) { res.json({hello: "world"}); });

response.respond(res);
0.3.0

9 years ago

0.2.7

9 years ago

0.2.6

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago