Rails apiSort Order

Rails API: Generating an API Only Rails App - [001]

In this episode we do a brief review of what we have so far for the front end and move over to generate the back end rails app that will serve our front-end. We can use the following command to generate an api-only rails app

rails new [app-name] --api --no-sprockets -d postgresql
  • The --api flag will generate controllers that inherit from ActionController::API .
  • The --no-sprockets flag will ensure that rails doesn't generate the assets compilation along with the app.
  • We don't need assets compilation because we will handle that ourselves using webpack.
  • Lastly the -d postgresql will configure the app to connect to PostgreSQL database.