So now to start adding some code so we can actually see something when we access our local host, take a look at what I have below. Note with the Sinatra framework you need to restart the server each time you run the code, I will cover a workaround for this shortly.
In our app Ruby file, we have included the Sinatra framework using the module ‘base’ and two get requests formatted with the address, ‘/’ representing our root or index and ‘/rps’ representing root/rps. As I previously discussed HTTP interacts with our client by making get/post requests, we are making get requests to our local server using our client when we run this code.
Now the issue regarding having to restart our server each time we restart our code, well thankfully in this scenario we can use a gem to automate this process named shotgun.