wip: Add rest api

Close #29
Implements #30 
Seeing `var self = this;` sent me on the hunt for a closure that needed it, but I didn't find one. The only reference to `self` is in the same scope as `this`.