I was in the same boat trying to make a Rails 5 API application that could still load from one html page (taken by JS at boot). Having stolen a hint from the rails source , I created the following controller (note that it uses Rails instead of mine ApplicationControllerfor this single non-api controller)
require 'rails/application_controller'
class StaticController < Rails::ApplicationController
def index
render file: Rails.root.join('public', 'index.html')
end
end
and put the appropriate static file (plain .html, not .html.erb) in the folder public. I also added
get '*other', to: 'static#index'
at the end routes.rb(after all my api routes) to ensure that client-side routing is maintained for reloads, deep links, etc.
routes.rb, Rails / non-api. public/index.html ( root routes.rb) , StaticController
get '*other', to: redirect('/')
, .
, - .