Skip to content

Instantly share code, notes, and snippets.

@parasquid
Forked from rayortigas/gist:4490968
Created January 15, 2013 14:58
Show Gist options
  • Save parasquid/4539214 to your computer and use it in GitHub Desktop.
Save parasquid/4539214 to your computer and use it in GitHub Desktop.
# config/environments/development.rb
Hello::Application.configure do
# ...
# https://rails.lighthouseapp.com/projects/8994/tickets/4676-reload-routes-on-each-request-in-dev-mode
service_reloader = ActiveSupport::FileUpdateChecker.new(Dir["app/services/**"]) { Rails.application.reload_routes! }
config.to_prepare do
service_reloader.execute_if_updated
end
end
# app/services/main_service.rb
require 'sinatra/base'
require 'sinatra/reloader'
class MainService < Sinatra::Base
configure :development do
register Sinatra::Reloader
end
get "/" do
"hi everybody!"
end
end
# config/routes.rb
Hello::Application.routes.draw do
mount MainService, at: "/api"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment