Incremental Migration from Rails to SPA: A Step-by-Step Guide
Table of Contents
Background
Provide a simple mechanism from creating a base Rails application with an incremental path to migrate to a SPA backing based on a namespace switch to /api.
The goal will be to keep all of the core business logic for persisting data in Rails but gradually move features to the front-end in either Angular or React.
Scenario
Create a mock Rails application
rails new appmigapi
Scaffold several objects
Document the external POST and GET endpoint
Create initial consumer of mock API
yeoman new react-app
Return JSON rather than HTML
respond_to :json
Load mock data
group :development, :test do gem 'faker' end