0.3.0 • Published 10 years ago

respondjs v0.3.0

Weekly downloads
56
License
MIT
Repository
github
Last release
10 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

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago