Open Make Puma Talk to Our App
GOAL: To make our Rack-compliant web application talk to Puma application server.
At this point, we have the Puma application server, and we also have our application app.rb
.
The only thing missing is the glue that connects the two.
How does Puma pass the incoming request to our application?
The answer is a rackup
file, which is just a Ruby file with .ru
extension. All Rails apps use this file. When you create a new Rails app, it's generated for you.
When we launch Puma (next step) without any arguments, it looks for this rackup file called config.ru in the current directory. Check out the Puma documentation to learn more.
So let's add a config.ru
file in the weby directory.
touch config.ru
Add the following code to this file. It loads the rack gem and also loads our application.
require 'rack'
require_relative './app'
run App.new
The run
method is provided by t