Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Rubyists Guide to Building an API Layer

Darby Frey
October 13, 2015

A Rubyists Guide to Building an API Layer

Darby Frey

October 13, 2015
Tweet

More Decks by Darby Frey

Other Decks in Technology

Transcript

  1. A Rubyists Guide to Building an API Layer Darby Frey

    Director of Platform Engineering - Belly
  2. Backend Stack • A Simple Framework for Building Microservices •

    Grape • Roar • ActiveRecord • https://github.com/bellycard/napa
  3. Monolith • Scaling problems • Slow to iterate (1+ hour

    builds, tight coupling) • One API for everything (lots of client concerns)
  4. Bellywall • Rails app proxy to SOA - SOA scales

    better • Authentication and Authorization layer (removed some complexity) • Nearly direct access to services
  5. Bellywall • Still a single API • Lots of requests

    (not mobile friendly) • Clever hacks • Little visibility
  6. DRY

  7. DRY

  8. Unit / Integration Testing • apigee-mock • Inspired by Sparrow.js

    • Provides a basic interface to the Apigee JS environment • Allows us to use nock to intercept and stub service requests • https://github.com/darbyfrey/apigee-mock
  9. Command Line Tool • apigee_cli • Wraps apigeetool for deployment

    • Provides a CLI interface to configs and resource files • https://github.com/bellycard/apigee_cli
  10. Command Line Tool • Uses .apigeerc for credentials • View

    and update configuration variables • View, change and remove resource files
  11. End To End Testing • clumsy • Uses ngrok •

    Allows for testing a proxy’s output instead of it’s response • https://github.com/darbyfrey/clumsy
  12. End To End Testing 1. Start a test by sending

    a request to a proxy 2. That request hits the proxy and gets proxied to the ngrok tunnel 3. The ngrok tunnel routes the request back to the same process that initiated the request 4. That process can make assertions based on that inbound request or send back stub data PROXY TEST NGROK