Start with the code provided here.
The server side code and routes have been provided for you. You shouldn't have to change anything in the server. No database needed, the server serves it all out from memory.
npm install
npm run server
npm run client
Try a GET to https://localhost:5000/people/
to see. POST works too with a body like
{name: 'person', role: 'their role'}
and Content-Type application/json
- In the
FamousSection
Component, there is a GET request and it fires off on load of the component. Take the response.data and assign it to the famousPeopleArray. - Add a bullet list of everyone in the
famousPeopleArray
array to the bottom of theFamousSection
Component. - When the Submit button is clicked, add the new famous person to the database with a POST request.
- Once a successful POST request has been made, the list on the DOM should update to show that new person.
- Clear the input fields after a new person is added.
Split the FamousSection
Component into 3 Components:
- a FamousPersonForm (to add a new person)
- a FamousPersonList (to display each person in the database)
- a FamousPerson (to display a single famous person's info as 'Felicia Day is famous for "The Guild". (Use this inside of the FamousPersonList component.)
- a delete button (you'll need to create a route for this too)