SinatraAPI.rb – a one script REST API Server in Ruby

Now for some code
The Gist below is a work in progress. The goal is “A REST API Server in one script”. It’s just for learning purposes, not a serious effort.
This version has:
- Resource model is a simple hash of Person objects, representing a team of three people to start with. No data mappers yet.
- It supports all four CRUD verbs – POST, GET, PUT, DELETE respectively. Each should return a decent HTTP response code!
- You can read the API with a browser or curl, but I use curl for the POST, PUT and DELETE. The API root has examples for you to copy and paste.
- It has a basic X-Api-Version response header.
- There’s no oauth nor any integration with any backend systems yet.
So, not much, but it achieves the goal so far so whatchagonnado?