Skip to content

Instantly share code, notes, and snippets.

@thomasyip
Created October 26, 2011 05:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasyip/1315555 to your computer and use it in GitHub Desktop.
Save thomasyip/1315555 to your computer and use it in GitHub Desktop.
Config.ru for Rails meets Sinatra
# /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
@thomasyip
Copy link
Author

See, https://gist.github.com/1315550 for /slim/slim.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment