Rocky Framework: Part 1

@Aron and I have been working on a framework called Rocky to make building APIs in your agent (even more) simple. We published an article on the Community Blog that explains the basic functionality of the framework. We’ll be following up with another blog post or two that goes into some of the fancier functionality (namely auth and exception handling at both a global, and per route level).

You can find the blog post here:
You can find the source code Rocky here:

This is great! My HTTP handlers have gotten pretty messy on occasion.

Guys thanks for this just the kind framework we and I’m sure you guys need. Will the Auth functionaly support HMAC? @fgarsombke

The Auth functionality allows you to assign an Auth function to a particular route - you could certainly implement something similar to the above… it basically looks like this:

app.get("/someEndPoint", function(context) { context.send("Hello World"); }).authorize(function(context) { // do auth logic and return true or false return true; }).onUnauthorized(function(context) { // this function is optional, by default failed auth requests will // send a 401 - Unauthorized context.send(401, "Unauthorized"); });

The .authorize function executes before the route handler. If authorize() returns true, the route handler is executed, if it returns false, the unauthorized handler is executed.

In a real world application, you would probably have an auth function for each level of access, then assign them to the route end points:

`function adminAuth(context) {
return isAdmin(context);

function readAuth(context) {
return canRead(context);

function writeAuth(context) {
return canWrite(context);

app.get("/someValue", function(context) {
context.send(“Hello World!”);
}).auth(readAuth);"/someValue", function(context) {


The .authorize function executes before the route handler
Matt that’s neat

Good to hear!

The main goal of Rocky is to make API development quicker, easier, and more clear by separating important functionality into seperate callbacks, and allowing you to assign those callbacks to specific API endpoints.