What is this file config.ru, and what is it for? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!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

Besides transaction validation, are there any other uses of the Script language in Bitcoin

Is this Kuo-toa homebrew race balanced?

How could a hydrazine and N2O4 cloud (or it's reactants) show up in weather radar?

How do I find my Spellcasting Ability for my D&D character?

Weaponising the Grasp-at-a-Distance spell

By what mechanism was the 2017 UK General Election called?

Russian equivalents of おしゃれは足元から (Every good outfit starts with the shoes)

First paper to introduce the "principal-agent problem"

Understanding piped commands in GNU/Linux

Did pre-Columbian Americans know the spherical shape of the Earth?

How to name indistinguishable henchmen in a screenplay?

Improvising over quartal voicings

How to achieve cat-like agility?

As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?

What does 丫 mean? 丫是什么意思?

How do I say "this must not happen"?

Dinosaur Word Search, Letter Solve, and Unscramble

Is the Mordenkainen's Sword spell underpowered?

Pointing to problems without suggesting solutions

Is there a verb for listening stealthily?

How do you cope with tons of web fonts when copying and pasting from web pages?

What is the proper term for etching or digging of wall to hide conduit of cables

Are there any irrational/transcendental numbers for which the distribution of decimal digits is not uniform?

The test team as an enemy of development? And how can this be avoided?



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



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!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,12461529




      2,12461529










      asked Mar 9 at 0:46









      Stas ChehovskihStas Chehovskih

      204




      204






















          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 env
              # 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 env
                                # 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 env
                                  # 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 env
                                    # 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 env
                                    # 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

                                    47.1k1060106




                                    47.1k1060106



























                                        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

                                        Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                                        Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                                        Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved