Serve the database by running
npm run serve:db
There's a REST resource that is being served at /events
.
Read the documentation for JSON Server, then open a REST Client file and create example requests for
- Get all events
- Get events with pagination using the query parameters
_limit
and_page
- Get a single event
- Create an event
- Update an event (complete)
- Delete an event
Now we want to implement these requests as Javascript functions using axios.
Open the file src/axios-exercise.js and try to implement the functions you find there.
The logAllEvents function is already implemented and can guide you. Use promises.
If you get stuck, checkout the axios documentation at https://github.com/axios/axios
You can run the test suite by running
npm run test
Make sure that the json-server is still running in the background.
When all tests are passing, refactor the event-service to use async await.