composure

Syntactic suger on top of restify with document generation

npm install composure
8 downloads in the last month

composure

Inspired by Swagger for Scala, composure is built on top of restify and provides a clean api for defining RESTful web service apis. At the same time, composure provides the ability to document your services along side the endpoint definitions and hadlers, and creates a documentation website.

Example

var composure = require("composure");

var app = composure();

var echoService = app.name("Hello, World!").service("echo").version("1.0.0");

var hello = function (req, res, next) {
  res.json(req.params.message);
  next();
};

var endpoint = echoService.get()
  .version("1.0.0")
  .handler(hello)
  .summery("Echo's back the message that you send")
  .description("<p>This is a very long description that might be multi-lined.</p>" +
               "<p>Use html if you want.  It will get escaped out of the summery</p>");

endpoint.resource("hello");
endpoint.param("message").summery("The message that you want echoed back");

endpoint = echoService.post()
  .version("1.0.0")
  .handler(hello)
  .summery("Echo's back the message that you send (POST as an example)")
  .description("<p>This is a very long description that might be multi-lined.</p>" +
               "<p>Use html if you want.  It will get escaped out of the summery</p>");

endpoint.resource("hello");
endpoint.param("message").summery("The message that you want echoed back");

app.listen(8080, function () {
  console.log("Now listening on port 8080");
});

Screenshot

composure
screenshot

Todos

  • [ ] Make the autogen documentation page prettier
  • [ ] Expose the restify jsonClient
  • [ ] Documentation
  • [ ] Test cases
npm loves you