Creating the Top Page - How to make a SPA with Cape.JS and Rails

Table of Contents - Next Section

Edit config/routes.rb so that its content becomes like as:

Rails.application.routes.draw do
  root 'top#index'
end

Create top#index action:

$ bin/rails g controller top index

Edit app/views/top/index.html.erb so that its content becomes like as:

<header class="jumbotron">
  <h1>Greeter</h1>
</header>

<div class='container'>
  <div class='card'>
    <div class='card-block'>
      <div id='main'></div>
    </div>
  </div>
</div>

Start the server:

$ bin/rails s

Open http://localhost:3000/ with your browser to see if the page is rendered without errors. It should have just a single “Greeter” heading.

Table of Contents - Next Section