config.ru What are you doing?

Introduction

When deploying an app created with Sinatra to Heroku, an error occurs that it is useless without config.ru. So I created config.ru and described various things, and it worked without problems. I wondered what config.ru is doing in the first place and decided to leave it as a memorandum.

What is ru in config.ru

It seems to be an abbreviation for rack up.

What is rack up

A command provided by a library (gem) called Rack.

What is Rack

Interface between web server and Ruby or Ruby frameworks (such as Rails and Sinatra). Without this, requests from the web server will not reach the app. Since the web server and frameworks such as Rails are talking in different languages, the framework side does not understand what is being said even if the web server asks. An image that allows Rack to translate both languages and exchange requests and responses by sandwiching them.

config.ru Rack works by passing the app's object to run.

Summary

Rack is a bridge between web servers and application servers. I got an error when deploying because the application server couldn't answer the web server request.

Recommended Posts

config.ru What are you doing?
bundle install? yarn install? What are you doing
Path setting after installation. What are you guys doing
Windows10 Eclipse environment construction & what are you doing Fukahori August 2020
[Rails] What are params?
[rails] What are Strong Parameters?
What you learned about hashes
What are command line arguments?
What you learned about symbols
[Environment variables] What are rails environment variables?
[Ruby] Forget what attr_reader, attr_writer, attr_accessor are doing many times
What are practically final variables?
What are Ruby class methods?
What are mass assignment vulnerabilities?
What are Java metrics? _Memo_20200818
Find out what many threads are doing from the jstack results
What are the rules in JUnit?
[Java] What are overrides and overloads?