[Ruby] [Ruby on Rails] From application creation to server startup & what is the port number?

2 minute read

This is a summary of the basics of Ruby on Rails.

1. Create an application.

Launch the terminal.

$ rails new application name

By executing the above command, a folder with the same name as the input application name will be created, and the folders and files required for development will be prepared in it.

Application name/
  ├ app/ Main folder of application
  ├ config/ Folder related to setting information
  ├ db/ Folder related to database
  └: Other

2. Start the server.

Type in terminal

$ rails server

Open localhost on port 3000 with a browser such as Google Chrome or Safari.


![Screenshot 2020-08-09 9.27.41.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/688029/cfe5c402-8727-3e79-b82b-(cea6d0a4dee3.png) Safely, Ruby on Rails has started.

Reference: [Ruby on Rails5 Learning Course I If you are an introduction to programming, you can learn from the basics Progate [Progate]](https://prog-8.com/lessons/rails5/study/1)

What is a port number?

This time, it came out as port number 3000, but the word port number is indispensable as knowledge about infrastructure.

Explanation of Internet terminology 1 minute-What is port number?-JPNIC explains as follows. I will.

In TCP/IP communication, the port number is the number that identifies the program used by the computer for communication. The port number is a 16-bit integer and has numbers 0 to 65535.

At deeper points, there are three types of port numbers.

  • Well-known port number (0 to 1023)-Port number for which purpose of use is defined
  • Registered port number (1024 to 49151)-IANA accepts registration and publishes
  • Dynamic/Private port number (49152 to 65535)-Open as a port that anyone can use freely

It is classified as above.

By the way, this time, port 3000 is used by default for Ruby on Rails and port 8000 is used for Django, but these 3000 and 8000 correspond to registered port numbers (1024 to 49151). , IANA accepts registration and is open to the public.

What is IANA?

Abbreviation for Internet Assigned Numbers Authority. It is a function to manage Internet resources such as domain name, IP address and AS number, protocol name and number used in each protocol. IANA was founded in 1988, led by the late Jonathan Bruce Postel of the Institute of Information Science (ISI), University of Southern California. IANA is one of the oldest institutions on the Internet and its activity can be traced back to the 1970s. Then, in October 1998, ICANN was established, and the role of global management and coordination of various resources that IANA played was taken over as a part of ICANN. From that background, it is used to mean the function of managing Internet resources, including historical ones. Quotation: JPRS Glossary|IANA

Since I can dig deeper into TCP/IP communication and HTTP, I plan to write articles when I have the opportunity.