Created
October 26, 2011 05:46
-
-
Save thomasyip/1315555 to your computer and use it in GitHub Desktop.
Config.ru for Rails meets Sinatra
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 | |
# This file is used by Rack-based servers to start the application. | |
# For Rails | |
require ::File.expand_path('../config/environment', __FILE__) | |
# For Sinatra | |
require './slim/slim.rb' | |
# - Make sinatra play nice | |
use Rack::MethodOverride | |
disable :run, :reload | |
# - Unlike Pratik's case, I have to disable this line for Rails to work | |
# use Rails::Rack::Static | |
# Mapping | |
# ------- | |
# Rest with Rails | |
map "/" do | |
run MyApp::Application | |
end | |
# Anything urls starting with /slim will go to Sinatra | |
map "/slim" do | |
# make sure :key and :secret be in-sync with initializers/secret_store.rb initializers/secret_token.rb | |
use Rack::Session::Cookie, :key => '<< see, initializers/secret_store.rb >>', :secret => '<< copy from initializers/secret_token.rb >>' | |
run AppMain | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See, https://gist.github.com/1315550 for /slim/slim.rb