Welcome Maester Nodeon, you have inherited this ledger from your predecessor.
Complete the following tasks to turn this ledger into a wealth of information for all of Westeros.
Ahem, we're going to turn a little technical now.
- Serve all the files in the
public
directory on the '/' path of your app. This exposes a frontend that makes requests to the app. - Create a
GET /api/beasts
to get all the records. The data can be found indata/beasts.json
- Checkout the / route in your browser!
- Add support for query parameter
species
in the created endpoint. Return an array of records that match the type.- Checkout the
Dragons
andDire wolves
pages!
- Checkout the
- Checkout the
Register a Beast
page. Create a handler forPOST /api/beasts
. Save this information back todata/beasts.json
.
Finished? How about some additional challenges? ๐
-
Add support for saving the image file in the
public/data/images
directory.- Send file data with the form from the frontend by adding
enctype
to the form.
<form action="/api/beasts" method="post" id="register-form" enctype="multipart/form-data">
- Send file data with the form from the frontend by adding
-
Implement a
PUT /api/beasts/:id
endpoint to replace the details of a beast. -
Implement
DELETE /api/beasts/:id
endpoint to delete a beast from the ledger.
npm i
npm start