pdurbin / addressbookmvc

http://todomvc.com but for the back end
4 stars 5 forks source link

Goal

Why?

The Original Idea

http://todomvc.com but using server-side technologies.

Implementation Guidelines

General

Contacts

A contact is completely described as:

{
  "id":   <integer>,
  "name": "<string>",
  "phone": "<string>"
}

SQL

If you choose to use an SQL-based persistence, here is some example DDL:

CREATE TABLE contacts (
id INTEGER NOT NULL PRIMARY UNIQUE AUTOINCREMENT,
name TEXT NOT NULL,
phone TEXT NOT NULL
);

The above is SQLite compatible syntax.

File

If you choose to use file-based persistence, please use OS-independent path handling/access where possible.

API

URI Responses1 HTTP Method (Verb) and Parameters Description
/contacts 200, 204 GET list all contacts
/contact 201, 400 POST with JSON representation of new contact create a new contact
/contact/\ 200, 404 GET display a specific contact
/contact/\ 200, 400, 404 PUT with JSON representation of new data update a specific contact
/contact/\ 204, 404 DELETE delete a specific contact