samedi 2 mai 2015

Configure Rails-API for 'normal' rails

The Rails-API gem provides a way to develop REST APIs with Rails. To this end it disables features from 'normal' rails used for developing web applications. When developing a web application that both renders html and serves API requests these features must be turned back on.

Question: What configuration and settings need to be changed to enable all features necessary for normal Rails development? Please keep ApplicationController inheriting from ActionController:API for the API part.

Things to consider:

  • Changes to application.rb:
    • Which middlewares are missing?
  • Which helpers to include in ApplicationController?
  • Gems?
  • Now serving both JSON and HTML.
  • What impact does config.api_only = false have?

Aucun commentaire:

Enregistrer un commentaire