To create a GET request handler in Ruby, you can use any web framework such as Sinatra, Ruby on Rails, or simply Net::HTTP.
Here is an example of creating a GET request handler using Sinatra:
main.rb56 chars6 lines
This code creates an HTTP GET request handler for the /hello
endpoint. When the endpoint is requested, the server responds with "Hello World!".
Here is an example of creating a GET request handler using Net::HTTP:
main.rb95 chars8 lines
This code creates an HTTP GET request to the example.com
domain and returns the response body.
gistlibby LogSnag