CSE 341: Web Services

W01 Assignment: Part 2 - Create the Plan

Overview

In this part of the assignment, you will turn your spec into a practical step-by-step plan. You will create a small set of tasks and create GitHub issues for them in the repository.

Because this is Week 01, this activity will walk you through the exact tasks and issue text to use. Later weeks will require you to create your own full list of tasks.

Defining Good Tasks

In this activity, you will learn how to create effective tasks for your project. What makes a good task?

Activity Instructions

The following steps will walk you through the process of creating GitHub issues for your project.

Determine the tasks

The first step is to break the spec into a short ordered list of coding tasks.

Recall from Part 1 that you will create an initial data collection, implement two endpoints, handle errors, and deploy the application. The main headings from Version 2 of the spec in Part 1 are:

The following is a way to break this down into manageable tasks:

  1. Create the books collection and connect the app to MongoDB.
  2. Implement the route to retrieve all books.
  3. Implement the route to retrieve one book by id.
  4. Deploy and test the application.

Confirm task order and size

The next step is to review your task plan to see if the order is clear, practical, and covers everything in the spec.

First, review the order of the tasks. In this case, the order matters because each task unlocks the next one. The collection and database connection need to be ready before route work can be completed and tested. Building GET /books before GET /books/:id lets you finish the simpler query first. Then you can reuse that code for a route that has an id in the URL.

Next, review the size of the tasks. Each task should be small enough to complete in one work session. In this case, the route work is already split into separate tasks, which keeps each issue focused and testable.

Create the issues

Now that you have a good plan, you can create detailed GitHub issues for each task in your plan.

Why use GitHub issues?

GitHub issues are a simple project management tool. They define scope, create a visible order of work, and support pull request tracking. When you work with a team, they help the team work together and see what is happening. Even for individual assignments, issues help you practice a professional workflow.

Create one issue per task. This will keep each issue focused on a single deliverable and include enough detail that another person (or an AI agent) could implement and test it. For every issue, include a title, a task description, and a Test Plan that identifies the exact checks needed to close the issue.

Copy and paste any relevant information from the spec into each issue.

As you review each issue below, pay attention to how the Test Plan translates the task into concrete checks that prove the work is complete.

Issue 1: Create the books collection and connect the app to MongoDB

Create the following issue at GitHub. In your repository, open the Issues tab, choose New issue, copy the title exactly, and paste the full description and Test Plan into the issue body. By using the checklist style language from the Test Plan, you will have clear acceptance criteria to verify that the work is complete.

Title: Create the books collection and connect the app to MongoDB

Description:
- Use MongoDB database `cse341-books-db`.
- Create a MongoDB collection named `books`.
- Insert at least 3 seed book documents with fields `id`, `author`, `title`, and `publicationDate`.
- Each book document should follow this data model:
  - `id`: string, required
  - `author`: string, required
  - `title`: string, required
  - `publicationDate`: string in ISO 8601 date format, required
- Example book document:
{
  "id": "b1",
  "author": "Maya Rivera",
  "title": "Patterns of Light",
  "publicationDate": "2021-08-17"
}
- Install the official MongoDB Node.js driver if needed.
- Configure the app to connect to MongoDB using environment variables.
- Update the server startup so the app connects to the database before it begins listening for requests to ensure that the connection is working.

Test Plan:
- The `cse341-books-db` database exists.
- The `books` collection exists with at least 3 documents.
- Each book document includes `id`, `author`, `title`, and `publicationDate`.
- Local app can connect to MongoDB without connection errors.
- Connection values are stored using environment variables (no secrets committed).
Issue 2: Implement a route to retrieve all books

Create the following issue at GitHub:

Title: Implement a route to retrieve all books

Description:
- Create route for `GET /books`.
- Query all documents from the `books` collection.
- Return a JSON array of book objects.
- Return HTTP 200 on success.
- Return HTTP 500 with a safe JSON message if an unexpected error occurs.
- Success response body example:
[
  {
    "id": "b1",
    "author": "Maya Rivera",
    "title": "Patterns of Light",
    "publicationDate": "2021-08-17"
  }
]
- Error response body example:
{
  "message": "Internal server error"
}

Test Plan:
- `GET /books` returns an array in JSON.
- Response status is 200 on success.
- Each returned book includes `id`, `author`, `title`, and `publicationDate`.
- Response uses `application/json`.
- Unexpected failures return `{ "message": "Internal server error" }` with status 500.
Issue 3: Implement a route to retrieve one book by id

Create the following issue at GitHub:

Title: Implement a route to retrieve one book by id

Description:
- Create route for `GET /books/:id`.
- Find one book document by the `id` field.
- Return a JSON object when found.
- Return HTTP 200 on success.
- Return HTTP 404 when a book is not found.
- Return HTTP 500 with a safe JSON message if an unexpected error occurs.
- Success response body example:
{
  "id": "b1",
  "author": "Maya Rivera",
  "title": "Patterns of Light",
  "publicationDate": "2021-08-17"
}
- Not found response body example:
{
  "message": "Book not found"
}
- Error response body example:
{
  "message": "Internal server error"
}

Test Plan:
- An existing id returns one book object in JSON.
- The returned book includes `id`, `author`, `title`, and `publicationDate`.
- A missing id returns `{ "message": "Book not found" }` with status 404.
- Response status is 200 on success.
- Response uses `application/json`.
- Unexpected failures return `{ "message": "Internal server error" }` with status 500.
Issue 4: Deploy and test the application

Create the following issue at GitHub:

Title: Deploy and test the application

Description:
- Deploy the latest version of the app to Render (including database connectivity and routes).
- Configure production environment variables in Render for MongoDB access.
- Test both endpoints (`GET /books` and `GET /books/:id`) against the deployed URL.
- Confirm data returned from the deployed API matches the documents you created at MongoDB.
- Confirm the deployed API follows the response examples from the spec:
  - `GET /books` returns an array of book objects.
  - `GET /books/:id` returns one book object for an existing id.
  - `GET /books/:id` returns `{ "message": "Book not found" }` for a missing id.
  - Unexpected server errors return `{ "message": "Internal server error" }`.

Test Plan:
- Deployed `GET /books` returns an array with status 200.
- Deployed `GET /books/:id` returns a book for an existing id with status 200.
- Deployed `GET /books/:id` returns 404 for a missing id.
- Deployed not-found and server-error responses return safe JSON messages.
- The final deployed URL is recorded in the README or in an issue comment.

Evaluate your GitHub Issues

You should now have four issues in your GitHub repository. Take a minute to review them.

If the answer to these questions is "yes" then you are ready to move forward. If the answer to any of them is "no" then you should update the issues before moving on.

GitHub issues are required

In order for your assignment to be marked complete, you must create these issues at GitHub and then later close them with a matching pull request.

Next Step

Continue to Part 3 - Implement the Plan.