The goal of this lab will be to make a single page contacts app that is connected to a rails backend. The repo has a working front end contacts app that does not use a database. Here is what you need to get it work with rails:
- Look over the code in
app/assets/javascript/contacts.js
and understand what it is doing. - Add a model to the rails app. It should be able to store and retreive all of the contact data that is being used in the javascript of the contacts app.
- Create an api for getting all of the contacts.
- TEST THE API WITH RSPEC. Make sure you do this before moving on.
- Use ajax in the javascript code to call the api you created and use the data that is returned in your contact app.
If you get done with the contacts app early, add the ability to filter out the contacts in the list. There should be a list of letters A-Z. When the user clicks a letter, A for example, all contacts that start with A are shown, but no other contacts. The user should be able to clear the filtering as well.
- Make sure you are requesting the correct data by adding .json to your url.
- Look at the jQuery docs to understand what is going on.