O'Reilly logo

Learning Sinatra by Manoj Sehrawat, Sudeep Agarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Handling HTTP Requests

In the previous chapter, we discussed the design of our database and how to use models and migrations efficiently. Now we know what we should take as input from the user and how to save it.

In this chapter, we will discuss the following topics:

  • How to write an application that will listen for requests
  • How to pass the requests to the model
  • How to write methods in the models to process the requests

Understanding the application file – app.rb

We require a web server that will receive requests from the user and process them. The web server will pass the request to the application, which will check what kind of request it is and process accordingly. When we execute our Sinatra application, it starts a web server that listens ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required