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;
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
add a comment |
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
add a comment |
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
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
ruby sinatra
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
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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.
add a comment |
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
add a comment |
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
edited Mar 9 at 4:00
answered Mar 9 at 2:52
EmmanuelEmmanuel
1,46632046
1,46632046
add a comment |
add a comment |
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
add a comment |
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
add a comment |
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
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
edited Mar 9 at 2:40
answered Mar 9 at 2:34
AxalixAxalix
2,39411432
2,39411432
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 9 at 12:57
maxmax
46.6k1060106
46.6k1060106
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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