Check out example codes for "start rails api postgres". It will help you in understanding the concepts better.

Code Example 1

rails new project-name-here --api --database=postgresql

Learn ReactJs, React Native from akashmittal.com