What is this file config.ru, and what is it for?What is attr_accessor in Ruby?Using Sinatra for larger projects via multiple files“rackup config.ru” returns nothing?How do I config.ru properly in modular Sinatra application.?How to add a config.ru to my gem?Sinatra not understanding settings in config.ru?Sinatra commands do not work in modulesInitializing an empty sinatra applicationSinatra - Test config.ru mappingDefine sinatra request routes in included files

Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?

Why does Kotter return in Welcome Back Kotter?

Languages that we cannot (dis)prove to be Context-Free

How much RAM could one put in a typical 80386 setup?

I'm flying to France today and my passport expires in less than 2 months

Did Shadowfax go to Valinor?

Meaning of に in 本当に

dbcc cleantable batch size explanation

strTok function (thread safe, supports empty tokens, doesn't change string)

What is a clear way to write a bar that has an extra beat?

What's that red-plus icon near a text?

What's the point of deactivating Num Lock on login screens?

Why is consensus so controversial in Britain?

RSA: Danger of using p to create q

What does "Puller Prush Person" mean?

Fully-Firstable Anagram Sets

What is the word for reserving something for yourself before others do?

tikz convert color string to hex value

Could an aircraft fly or hover using only jets of compressed air?

Which country benefited the most from UN Security Council vetoes?

Why doesn't H₄O²⁺ exist?

What do the dots in this tr command do: tr .............A-Z A-ZA-Z <<< "JVPQBOV" (with 13 dots)

How do I draw and define two right triangles next to each other?

NMaximize is not converging to a solution



What is this file config.ru, and what is it for?


What is attr_accessor in Ruby?Using Sinatra for larger projects via multiple files“rackup config.ru” returns nothing?How do I config.ru properly in modular Sinatra application.?How to add a config.ru to my gem?Sinatra not understanding settings in config.ru?Sinatra commands do not work in modulesInitializing an empty sinatra applicationSinatra - Test config.ru mappingDefine sinatra request routes in included files






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















What is this file config.ru, and what is it for in Sinatra projects? In my lanyard of the project, such code is written:



require './app'
run Sinatra::Application









share|improve this question






























    2















    What is this file config.ru, and what is it for in Sinatra projects? In my lanyard of the project, such code is written:



    require './app'
    run Sinatra::Application









    share|improve this question


























      2












      2








      2








      What is this file config.ru, and what is it for in Sinatra projects? In my lanyard of the project, such code is written:



      require './app'
      run Sinatra::Application









      share|improve this question
















      What is this file config.ru, and what is it for in Sinatra projects? In my lanyard of the project, such code is written:



      require './app'
      run Sinatra::Application






      ruby sinatra






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 at 1:05









      Pikachu the Purple Wizard

      2,03061529




      2,03061529










      asked Mar 9 at 0:46









      Stas ChehovskihStas Chehovskih

      183




      183






















          3 Answers
          3






          active

          oldest

          votes


















          4














          config.ru (the .ru stands for "rackup") is a Rack configuration file. Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks. It's like a Ruby implementation of a CGI which offers a standard protocol for web servers to execute programs.



          Rack's run here means for requests to the server, make Sinatra::Application the execution context from which Sinatra's DSL could be used. All DSL methods on the main are then delegated to this class.



          So essentially in this config.ru file what's happening is this:



          First you require your app code which uses Sinatra's DSL then run the Sinatra framework... so in the context of Sinatra::Application if your app.rb contained something like



          get '/' do
          'Hello world!'
          end


          The get block would mean something to Rack, in this case,




          send back 'Hello world!'




          Which your application will show to you in your browser.






          share|improve this answer
































            2














            config.ru is a default configuration file for a rackup command with a list of instructions for Rack.



            Rack is an interface and architecture that provides a domain specific language (DSL) and connects an application with a world of web. In two words, it allows to build web applications and work with requests, responses (and many other web-related technologies) in a most convenient way.



            Sinatra as well as Rails are web frameworks, so they both use Rack:



            http://recipes.sinatrarb.com/p/middleware



            https://guides.rubyonrails.org/rails_on_rack.html






            share|improve this answer
































              0














              Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks.



              The interface just assumes that you have an object that responds to a call method (like a proc) and returns a array with:



              • The HTTP response code

              • A Hash of headers

              • The response body, which must respond to each

              You can run a basic Rack server with the rackup command which will search for a config.ru file in the current directory.



              You can create a minimal hello world server with:



              # config.ru
              run Proc.new
              # run this with the `rackup` command


              Since Sinatra just like Rails builds on Rack it uses rackup internally to interface between the server and the framework. config.ru is thus the entry point to any Rack based program.



              What is does it bootstrap the application and passes the Sinatra::Application class to rack which has a call class method.



              Sinatra::Application is then responsible for taking the incoming request (the env) and passing it to the routes your application provides and then passing back the response code, headers and response body.






              share|improve this answer























                Your Answer






                StackExchange.ifUsing("editor", function ()
                StackExchange.using("externalEditor", function ()
                StackExchange.using("snippets", function ()
                StackExchange.snippets.init();
                );
                );
                , "code-snippets");

                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "1"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                draft saved

                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072891%2fwhat-is-this-file-config-ru-and-what-is-it-for%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                4














                config.ru (the .ru stands for "rackup") is a Rack configuration file. Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks. It's like a Ruby implementation of a CGI which offers a standard protocol for web servers to execute programs.



                Rack's run here means for requests to the server, make Sinatra::Application the execution context from which Sinatra's DSL could be used. All DSL methods on the main are then delegated to this class.



                So essentially in this config.ru file what's happening is this:



                First you require your app code which uses Sinatra's DSL then run the Sinatra framework... so in the context of Sinatra::Application if your app.rb contained something like



                get '/' do
                'Hello world!'
                end


                The get block would mean something to Rack, in this case,




                send back 'Hello world!'




                Which your application will show to you in your browser.






                share|improve this answer





























                  4














                  config.ru (the .ru stands for "rackup") is a Rack configuration file. Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks. It's like a Ruby implementation of a CGI which offers a standard protocol for web servers to execute programs.



                  Rack's run here means for requests to the server, make Sinatra::Application the execution context from which Sinatra's DSL could be used. All DSL methods on the main are then delegated to this class.



                  So essentially in this config.ru file what's happening is this:



                  First you require your app code which uses Sinatra's DSL then run the Sinatra framework... so in the context of Sinatra::Application if your app.rb contained something like



                  get '/' do
                  'Hello world!'
                  end


                  The get block would mean something to Rack, in this case,




                  send back 'Hello world!'




                  Which your application will show to you in your browser.






                  share|improve this answer



























                    4












                    4








                    4







                    config.ru (the .ru stands for "rackup") is a Rack configuration file. Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks. It's like a Ruby implementation of a CGI which offers a standard protocol for web servers to execute programs.



                    Rack's run here means for requests to the server, make Sinatra::Application the execution context from which Sinatra's DSL could be used. All DSL methods on the main are then delegated to this class.



                    So essentially in this config.ru file what's happening is this:



                    First you require your app code which uses Sinatra's DSL then run the Sinatra framework... so in the context of Sinatra::Application if your app.rb contained something like



                    get '/' do
                    'Hello world!'
                    end


                    The get block would mean something to Rack, in this case,




                    send back 'Hello world!'




                    Which your application will show to you in your browser.






                    share|improve this answer















                    config.ru (the .ru stands for "rackup") is a Rack configuration file. Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks. It's like a Ruby implementation of a CGI which offers a standard protocol for web servers to execute programs.



                    Rack's run here means for requests to the server, make Sinatra::Application the execution context from which Sinatra's DSL could be used. All DSL methods on the main are then delegated to this class.



                    So essentially in this config.ru file what's happening is this:



                    First you require your app code which uses Sinatra's DSL then run the Sinatra framework... so in the context of Sinatra::Application if your app.rb contained something like



                    get '/' do
                    'Hello world!'
                    end


                    The get block would mean something to Rack, in this case,




                    send back 'Hello world!'




                    Which your application will show to you in your browser.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 9 at 4:00

























                    answered Mar 9 at 2:52









                    EmmanuelEmmanuel

                    1,46632046




                    1,46632046























                        2














                        config.ru is a default configuration file for a rackup command with a list of instructions for Rack.



                        Rack is an interface and architecture that provides a domain specific language (DSL) and connects an application with a world of web. In two words, it allows to build web applications and work with requests, responses (and many other web-related technologies) in a most convenient way.



                        Sinatra as well as Rails are web frameworks, so they both use Rack:



                        http://recipes.sinatrarb.com/p/middleware



                        https://guides.rubyonrails.org/rails_on_rack.html






                        share|improve this answer





























                          2














                          config.ru is a default configuration file for a rackup command with a list of instructions for Rack.



                          Rack is an interface and architecture that provides a domain specific language (DSL) and connects an application with a world of web. In two words, it allows to build web applications and work with requests, responses (and many other web-related technologies) in a most convenient way.



                          Sinatra as well as Rails are web frameworks, so they both use Rack:



                          http://recipes.sinatrarb.com/p/middleware



                          https://guides.rubyonrails.org/rails_on_rack.html






                          share|improve this answer



























                            2












                            2








                            2







                            config.ru is a default configuration file for a rackup command with a list of instructions for Rack.



                            Rack is an interface and architecture that provides a domain specific language (DSL) and connects an application with a world of web. In two words, it allows to build web applications and work with requests, responses (and many other web-related technologies) in a most convenient way.



                            Sinatra as well as Rails are web frameworks, so they both use Rack:



                            http://recipes.sinatrarb.com/p/middleware



                            https://guides.rubyonrails.org/rails_on_rack.html






                            share|improve this answer















                            config.ru is a default configuration file for a rackup command with a list of instructions for Rack.



                            Rack is an interface and architecture that provides a domain specific language (DSL) and connects an application with a world of web. In two words, it allows to build web applications and work with requests, responses (and many other web-related technologies) in a most convenient way.



                            Sinatra as well as Rails are web frameworks, so they both use Rack:



                            http://recipes.sinatrarb.com/p/middleware



                            https://guides.rubyonrails.org/rails_on_rack.html







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Mar 9 at 2:40

























                            answered Mar 9 at 2:34









                            AxalixAxalix

                            2,39411432




                            2,39411432





















                                0














                                Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks.



                                The interface just assumes that you have an object that responds to a call method (like a proc) and returns a array with:



                                • The HTTP response code

                                • A Hash of headers

                                • The response body, which must respond to each

                                You can run a basic Rack server with the rackup command which will search for a config.ru file in the current directory.



                                You can create a minimal hello world server with:



                                # config.ru
                                run Proc.new
                                # run this with the `rackup` command


                                Since Sinatra just like Rails builds on Rack it uses rackup internally to interface between the server and the framework. config.ru is thus the entry point to any Rack based program.



                                What is does it bootstrap the application and passes the Sinatra::Application class to rack which has a call class method.



                                Sinatra::Application is then responsible for taking the incoming request (the env) and passing it to the routes your application provides and then passing back the response code, headers and response body.






                                share|improve this answer



























                                  0














                                  Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks.



                                  The interface just assumes that you have an object that responds to a call method (like a proc) and returns a array with:



                                  • The HTTP response code

                                  • A Hash of headers

                                  • The response body, which must respond to each

                                  You can run a basic Rack server with the rackup command which will search for a config.ru file in the current directory.



                                  You can create a minimal hello world server with:



                                  # config.ru
                                  run Proc.new
                                  # run this with the `rackup` command


                                  Since Sinatra just like Rails builds on Rack it uses rackup internally to interface between the server and the framework. config.ru is thus the entry point to any Rack based program.



                                  What is does it bootstrap the application and passes the Sinatra::Application class to rack which has a call class method.



                                  Sinatra::Application is then responsible for taking the incoming request (the env) and passing it to the routes your application provides and then passing back the response code, headers and response body.






                                  share|improve this answer

























                                    0












                                    0








                                    0







                                    Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks.



                                    The interface just assumes that you have an object that responds to a call method (like a proc) and returns a array with:



                                    • The HTTP response code

                                    • A Hash of headers

                                    • The response body, which must respond to each

                                    You can run a basic Rack server with the rackup command which will search for a config.ru file in the current directory.



                                    You can create a minimal hello world server with:



                                    # config.ru
                                    run Proc.new
                                    # run this with the `rackup` command


                                    Since Sinatra just like Rails builds on Rack it uses rackup internally to interface between the server and the framework. config.ru is thus the entry point to any Rack based program.



                                    What is does it bootstrap the application and passes the Sinatra::Application class to rack which has a call class method.



                                    Sinatra::Application is then responsible for taking the incoming request (the env) and passing it to the routes your application provides and then passing back the response code, headers and response body.






                                    share|improve this answer













                                    Rack provides a minimal interface between webservers that support Ruby and Ruby frameworks.



                                    The interface just assumes that you have an object that responds to a call method (like a proc) and returns a array with:



                                    • The HTTP response code

                                    • A Hash of headers

                                    • The response body, which must respond to each

                                    You can run a basic Rack server with the rackup command which will search for a config.ru file in the current directory.



                                    You can create a minimal hello world server with:



                                    # config.ru
                                    run Proc.new
                                    # run this with the `rackup` command


                                    Since Sinatra just like Rails builds on Rack it uses rackup internally to interface between the server and the framework. config.ru is thus the entry point to any Rack based program.



                                    What is does it bootstrap the application and passes the Sinatra::Application class to rack which has a call class method.



                                    Sinatra::Application is then responsible for taking the incoming request (the env) and passing it to the routes your application provides and then passing back the response code, headers and response body.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Mar 9 at 12:57









                                    maxmax

                                    46.6k1060106




                                    46.6k1060106



























                                        draft saved

                                        draft discarded
















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid


                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.

                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072891%2fwhat-is-this-file-config-ru-and-what-is-it-for%23new-answer', 'question_page');

                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                                        2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

                                        Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme