> For the complete documentation index, see [llms.txt](https://wiki.berkie.ee/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.berkie.ee/techops/getting-started-projects/web-demo-project/assignment-1-http-requests.md).

# Assignment 1: HTTP Requests

This assignment gives you practice using HTTP requests to your local server. Feel free to use Postman or Insonmia to run these requests. Remember, Google is your friend! Since you're all starting to learn this infrastructure, rely on ChatGPT as little as possible so you actually *remember* how to do these things!&#x20;

Now that you have your server running, you should see a landing page with a small library of books. Our task is to find a way to manage this library! We want to

1. retrieve the list of books
2. add a new book
3. update an existing catalog entry
4. remove a book

Which HTTP request corresponds to which action?

### Your Task

Look through `server.js`. This should contain all the existing server code that exposes these possible actions to a user.&#x20;

Additionally, to give you some more context, there's a database file that's cleared and repopulated every time the server restarts. If you restart the server, you will clear the database!

Based on the code in the file, please write the following:

1. a request to get all the books
2. add a new book to the library
3. update the author of an existing book
4. remove a book from the library

You may do this in several ways:

* Postman/Insomnia provides a user-friendly way to make these requests. Feel free to search wherever to learn how to use these tools
* Write Python, JavaScript, or any other code to make these requests. Postman also generates code for you, so you might find that feature helpful.
* Write cURL requests. These are much harder for people to read but they work!&#x20;

Some tips:

* You may want to figure out what the data structure looks like for each database entry, or what data structure is used in general. Hint: they look pretty similar to Python dictionaries! Which fields are critical to operation?
* Feel free to try as many things out as you want. Since everything is local to your computer and the database resets on server restart, nothing destructive will happen!

### Changing code:

If you locate any errors, improvements, or code changes, please follow our workflow! Branch, modify your code, commit, then make a PR and one of the project leads will review it!&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.berkie.ee/techops/getting-started-projects/web-demo-project/assignment-1-http-requests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
