Simple Rack app as a Ruby file instead of config.ru.
✓ Published0🌍 Public
AAndrelton
Last edited Nov 10, 2015
Created on Nov 10, 2015
This example shows a minimal Ruby web application built directly inside a single Ruby file, bypassing the conventional `config.ru` setup. It defines a `Hello` class with a `call` method that returns a static HTTP response—a status code of `'200'`, a `'Content-type'` header of `'text/html'`, and a simple HTML heading. The code uses the `rack` library’s `Rack::Handler::WEBrick.run` to launch the server, with the app logic exposed through the Rack interface. It also demonstrates how to start the server via the command line and test it with a GET request.
AI-generated description