Ruby on Rails - Creating an api only application in ruby on rails - ruby on rails tutorial - rails guides - rails tutorial - ruby rails
Creating an API-only application
- To build a Rails application that will be an API server, we can start with a more limited subset of Rails in Rails 5.
- To generate a new Rails API app:
- What --api does is to remove functionality that is not needed when building an API. This includes sessions, cookies, assets, and anything that makes Rails work on a browser.
- It will also configure the generators so that they don't generate views, helpers, and assets when generating a new resource.
- We compare the ApplicationController on a web app versus an API app, we will see that the web version extends from ActionController::Base, whereas the API version extends from ActionController::API, which includes a much smaller subset of functionality.