Tuesday, April 23, 2013

Express REST Controller - Rapid REST APIs

Ever wanted to create a RESTful interface on your Node/Express server that exposes an in-memory Backbone Collection with one line of code?

Okay, so that's probably just me but let me know what you think of this:

Express REST Controller on GitHub

It can be used to create multiple REST APIs on a Backbone Collection like so:

var app = express();
var customerController = new Controller().bind(app, 'customer');
var orderController = new Controller().bind(app, 'order');
var itemController = new Controller().bind(app, 'item');

After executing these lines you can now hit your Node/Express server with full CRUDL at /customer, /order and /item.

I think it's cool.

No comments: