Created
May 4, 2012 18:38
-
-
Save djones/2596822 to your computer and use it in GitHub Desktop.
Sudocode on how I would like Grape to work with Goliath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sudocode on how I would like grape to work with Goliath | |
# http://localhost:9000/randomuser #=> random user in json | |
require 'goliath' | |
require 'grape' | |
require 'em-synchrony/activerecord' | |
class User < ActiveRecord::Base | |
end | |
class MyAPI < Grape::API | |
get 'randomuser' do | |
User.offset(rand(User.count)).first | |
end | |
end | |
class Srv < Goliath::API | |
map "/" do | |
run MyAPI.new(self) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jpfuentes2 do you have any other examples of Goliath and REST APIs? Or know of any out there?
Now I've created a Goliath + Grape example here: https://github.com/djones/grape-goliath-example I'm interested to write the same example just with Goliath and see how it compares speed wise.