The goal of this exercise is to design and implement a front-end (in Javascript, Bootstrap, and jQuery) able to exploit the a set of REST APIs for the todo list manager (developed in Lab 6).
Exercise steps:
- See the
index.html
template: it already gives a (static) example page - Attach an event handler to the "+" button, to insert a new task:
- collect task name and urgency
- call the REST
POST /tasks
service to add the new task - use
$.ajax
to send the JSON description of the new task
- Before testing, modify Lab6 to enable CORS (cross-domain) requests, and deploy the two applications (server and front-end) on different ports
- Generate the table by querying the REST server for all current tasks.
- empty the current table
- use
$.ajax
for calling theGET /tasks
API - use the returned value to re-construct the table
- ensure that the table is reloaded (1) at startup, (2) when a task is added
- Enable the delete function for existing tasks
- register an event handler on the delete icon
- find the task ID corresponding to the row (suggestion: use
data-xxx
HTML5 attributes, and $.data('xxx') jQuery function for retrieving them) - use
$.ajax
to call theDELETE /tasks/id
API (ensure that CORS allows DELETE)
- Enable the edit function for existing tasks
The solution for all points is in the solution branch