Here's a simple example of creating an HTTP server with a specific route in Ruby using the WEBrick
library:
main.rb250 chars14 lines
This code creates a server on port 3000 and specifies a route /hello
which responds with a simple "Hello, world!" message. When you start the server and visit http://localhost:3000/hello
in your web browser, you should see the message displayed.
gistlibby LogSnag