-
-
Save parasquid/4539214 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/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