If your routes file is overwhelmingly big, you can put your routes in multiple files and include each of the files with Ruby’s require_relative
method:
config/routes.rb
:
YourAppName::Application.routes.draw do
require_relative 'routes/admin_routes'
require_relative 'routes/sidekiq_routes'
require_relative 'routes/api_routes'
require_relative 'routes/your_app_routes'
end
config/routes/api_routes.rb
:
YourAppName::Application.routes.draw do
namespace :api do
# ...
end
end