Over the next few months I plan on writing a simple CRUD program in different languages, sometimes with a separate frontend and backend, other times as one program. The whole goal of this will be as a learning experience for me.
So for starters, I will do a simple address book.
So for this we will need a field for First name, Last name, Mailing Address, City, State, Zip, Phone(s), and Notes.
An API will also be established, with the URL playing a role. So for starting out I should be able to retrieve a listing of all entries, showing First name, Last name, and Phone. So when I call /contacts I should see this list.
Then for getting a single entry I should be able to call /contact/# with the # being the ID number given to me by /contacts.
For adding an entry, the save function should be /contact/create, with the update function calling /contact/#/update.
Finally, for deleting an entry it should call /contact/#/delete.
Depending on the language the end-points may change. Starting out I plan on using JSON for any data transfers, so all the URLs will be prefixed with /json-api. In the end for the ones with the decoupled front and backends, you should be able to swap any frontend with any backend and the program should still work.
API URL | Action |
---|---|
/contacts | List all Contacts |
/contact/create | Create a Single Contact |
/contact/# | View a Single Contact |
/contact/#/update | Update a Single Contact |
/contact/#/delete | Delete a Single Contact |