Created
September 17, 2012 17:42
-
-
Save jcran/3738708 to your computer and use it in GitHub Desktop.
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
===== config.ru | |
require 'api' # Loads the app(s) | |
map("/v1/component_a") do | |
run Sinatra.new(Pwnix::ComponentA) | |
end | |
map("/v1/component_b") do | |
run Sinatra.new(Pwnix::ComponentB) | |
end | |
===== end config.ru | |
===== api.rb | |
# Gems | |
require 'sinatra/base' | |
require 'sinatra/namespace' | |
require 'json' | |
# Load Component Routes | |
require_relative 'controllers/componenta' | |
require_relative 'controllers/componentb' | |
# Load Libraries | |
require_relative 'componenta/init' | |
require_relative 'componentb/init' | |
===== end api.rb | |
===== componenta.rb | |
class ComponentA < Sinatra::Base | |
# Namespace Library | |
register Sinatra::Namespace | |
get '/something' do | |
"hello from component a" | |
end | |
end | |
===== end componenta.rb | |
===== componentb.rb | |
class ComponentB < Sinatra::Base | |
# Namespace Library | |
register Sinatra::Namespace | |
get '/something' do | |
"hello from component b" | |
end | |
end | |
===== end componentb.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment