M
M
Matvey Mamonov2016-04-23 22:45:21
Ruby on Rails
Matvey Mamonov, 2016-04-23 22:45:21

How do Ruby web frameworks teach headers?

Standard Ruby, as far as I know, does not have any built-in tools for manipulating web headers, as, for example, in PHP. So how then are all these numerous web frameworks like Rails, Padrino, Sinatra written? After all, their main essence is the operation of headers with the subsequent processing of routes.
Here I created, for example, the hi.rb file. What do I need to write to it (let me have Passenger as application-server) to let it know that if someone entered mysite / hi in the line, I need to print "Hello World", and if mysite/signup, then you need to display the header form?
For the life of me, I can’t move further in studying frameworks until I know how the logic of their work is organized.
There is an idea that these methods are provided by the web and application servers themselves, but where can I find documentation on aspects of working with them, say?
If you look at the Sinatra sources, then in the middle of the Base class of the Sinatra module, header() methods appear from somewhere (maybe I missed something or misunderstood, correct me), which are just involved in processing requests.
How to organize this yourself?
And further. In Rails, you can use various application servers, such as Unicorn, Passenger, standard WEBrick, thin. Does the Rails code itself support all servers? Or does each of them provide the same final methods of work?
I would like to hear a detailed answer, specifically explaining the essence of the work of such applications.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Demidenko, 2016-04-23
@eucalipt

I think you need Rack

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question