This challenge is about the data exchange between different web components. In the core the site will show a form to submit user data and a list to display the submitted data. The user should be able to add, edit and delete data entries.
The site of this challenge will be divided into two main parts:
Adding data will trigger an update of the list as does editing or deleting an item from the list. This results in three web components:
data-form: A form to submit new data or edit existing datadata-list: A list to display the submitted datadata-list-item: An item in the list representing a single data entryTo facilitate a mediator pattern between the data-list en data-form components, a parent component data-exchange will also be created.
The wireframe below shows the layout of the components on the page.
In case of editing an item, the form will be pre-filled with the data of the selected item and the button text will change from "Add" to "Update".
Select the component to view its documentation:
To store the submitted data, we will use a simple REST API with the following endpoints:
GET /api/user: Retrieve all data entriesPOST /api/user: Create a new data entryPUT /api/user/:id: Update an existing data entryDELETE /api/user/:id: Delete a data entryThe backend will be realized by using JSON Server, a simple tool to create a REST API with zero coding.