I am creating a web app using Ruby and Sinatra, and I’m splitting up the various aspects into separate Sinatra::Base classes, like so:
class Frontend < Sinatra::Base
get '/' do
erb :home
end
end
class Backend < Sinatra::Base
get '/account' do
erb :account
end
end
Now I want to use the not_found and error routes, but I don’t want to duplicate them in both classes.
What’s the best way to declare them once and have them apply to routes in both classes?
1 Answer