Before getting started, we have to install Cuba. Use the
gem
command:
$ gem install cuba
Now that Cuba is installed, it’s easy to create a Cuba application. Open your text editor of preference and create a file called
config.ru
with the following code:
require "cuba"Cuba.definedo on rootdo res.write("Hello, Cuba!") endendrun(Cuba)
You already have a functional Cuba application! To see it in action, type
rackup config.ru
in the command line.Now open a browser and navigate tohttp://localhost:9292/. It should show a greeting message as shown below:
NOTE:
To stop the web server, hit
Ctrl+C
in the terminal window where it’s running. To verify the server has stopped youshould see your command prompt cursor again.
Leave a Reply