Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's Rack based servers in Ruby [closed]

in any rails new project , there exist config.ru which containns Rack configs for Rack base servers, and here is it's official website http://rack.github.io/

the Question is: what is it's exact use in Ruby?

like image 371
Hanaa Gaafar Avatar asked Nov 20 '14 13:11

Hanaa Gaafar


1 Answers

Rack is what's called Middleware. It's a layer that sits between your rails app and the webserver. So instead of Rails having to know how to talk to HTTP, it just has to know how to talk to Rack. Rack handles all of the HTTP information coming in & out. And formats the request object, the response object and such with all the header information and details that you use in your app.

Just to add, the config.ru file is essentially the file rack executes when it starts up. You can start your own rack application by running:

rackup config.ru
like image 159
agmcleod Avatar answered Nov 15 '22 02:11

agmcleod