Rails 4 Api

screenshot of Rails 4 Api

Template app for a tested, documented and versioned JSON API using Rails 4 and Rails-Api

Overview

This article introduces a sample template Rails 4 app that can be used to build a tested, documented, and versioned JSON API. The app includes Rails-API, Devise for token-based authentication, and Cucumber for integration testing and up-to-date API documentation. The article explains the benefits of using Cucumber for API testing and emphasizes the use of natural language steps to create readable and expressive integration tests.

Features

  • Rails-API: Rails for API only apps
  • Devise for token based authentication: Provides a secure way to authenticate API requests using tokens
  • Cucumber for integration testing + up-to-date API documentation: Enables writing integration tests in a natural language format, which can also serve as documentation for the APIs
  • Versioning using the "Accept" header: Supports versioning of the API by specifying the version in the "Accept" header
  • Does not depend on cookies/session: Allows the API client to be any application that can interact with the API using HTTP requests

Summary

This article introduces a template Rails 4 app that can be used to build a tested, documented, and versioned JSON API. The app includes features such as Rails-API, Devise for token-based authentication, and Cucumber for integration testing and up-to-date API documentation. The article highlights the benefits of using Cucumber for API testing and emphasizes the use of natural language steps to create readable and expressive integration tests. It also provides installation instructions for setting up the template app.