Today I learned more about Cuba.

I created a new repository with the name: migraine-app

I’m using the following gems for my application:

require "cuba"
require "mote"
require "mote/render"

Cuba.plugin(Mote::Render)

Cuba.use Rack::Static,
  urls: %w[/js /css /img],
  root: File.expand_path("./public", __dir__)

Cuba.define do
  on(root) do
    render("index", title: "Hola")
  end

  on("login") do
    render("login", title: "Login")
  end

  on("user") do
    render("user", title: "User")
  end

  on("inputs") do
    render("inputs", title: "Inputs")
  end

  on("outputs") do
    render("outputs", title: "Outputs")
  end

  on("dashboard") do
    render("dashboard", title: "Dashboard")
  end

end

To run the application on the server, you need to install the following gem: mote Remember, you need to write in the terminal:

$ gem install mote

To run the application you need to execute the following on your terminal:

$ rackup config.ru

Now we will get an error, why? If you read what the terminal tells us, we need to install mote-render:

yo

$ gem install mote-render

Now, you can run the application without problems:

$ rackup config.ru

Go to http://localhost:9292 and that’s it!