Rails API From Scratch
Step by step process of creating rails API:
Step 1: Update rails to the latest version:

If you don’t already have the latest version of rails API, upgrade it.
Step 2: Create a folder

Step 3: Create rails API

Although you can use other databases such as sqlite3, I will be using PostgreSQL.
The — api makes the data configure serve as json instead of HTML, it sets all the controller appropriately, etc. The — database=postgresSQL is for deployment.
Step 4: cd into the rails api_app

Once you one the app, you can view folders like controllers, models, views, database, etc.
Congratulations, you just completed your initial battle!!!