main.rb247 chars14 lines
In the above code snippet, we first require the webrick
library which provides an HTTP server implementation in Ruby. Then, we create a new instance of WEBrick::HTTPServer
class which listens to port 8000
.
Next, we define a new route for /options
by using server.mount_proc
method. In this route, we set the Allow
header to specify which HTTP methods are allowed in the response.
Finally, we start the HTTP server by calling the server.start
method. Now, the server is ready to accept incoming HTTP requests on port 8000
.
gistlibby LogSnag