Starting the Rails server
A generated app does nothing until something runs it
Rails CLI: rails new generated a whole app: models, views, controllers and config, sitting on disk. None of it does anything yet. A Rails app is just files until a process starts reading requests and running the code. That process is bin/rails server.
bin/rails server
Running it in this project prints something like this:
=> Booting Puma
=> Rails 8.1.4 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Listening on http://127.0.0.1:3000
Three things happened. Rails booted, loading config/application.rb, initializers and the rest. Puma started as the web server underneath. And it began listening on port 3000, the default. Opening http://localhost:3000 in a browser now reaches this process.
Puma was already mentioned, this course goes deeper
The web: request-response named Puma as the first layer a request passes through, the piece that receives raw HTTP and hands it to Rack. That course followed the whole request journey. This one is about Puma: starting it, configuring it, and what "workers" and "threads" in its output and config mean.
Stopping it
Ctrl+C in the terminal running bin/rails server stops Puma and returns you to the shell. There's no separate stop command; the server runs only while that terminal keeps it in the foreground.
Key takeaways
- A generated app is inert until
bin/rails serverstarts Puma, the process that listens for HTTP requests. - The boot output shows Rails loaded, Puma started, and it's listening, on port 3000 by default.
- The web: request-response covered the whole journey; this course is about Puma itself.
Ctrl+Cstops the server, which runs only while its terminal process lives.
Keep going with lesson 2
What is Puma, and why not WEBrick?
Why WEBrick left Ruby's default gems, where Puma came from, and why Rails made it the default.
A free account also gives you the quizzes, your progress and notes, and the discussion.