# Week 7: Midterm Project

  • AMA (15 min)
  • Midterm Project

# Pokemon API


Pokemon CRUD With Middleware
Midterm

Due before our week 8 class.

Counts for 15% of your final grade.

# The brief

This is the second of three take home assignments in this course that will be related, with later assignments building on the functionality of earlier ones. You are going to build the backend web services to support a simple pokemon list application called pokemonApi.

For this assignment, you will upgrade the base of the pokemonApi RESTful API using middleware and a proper file structure.

# Core Requirements

  1. Using the Express.js framework, the API will expose a full set of CRUD routes (six, including both put and patch) for pokemon and trainer resources:. All API resource paths must begin with /api.

The resource objects will have the following properties:

# Pokemon

Property Type
id Number
name String
type String
abilities [String]

Download the pokemon.json file from here (opens new window).

# Trainer

Property Type
id Number
firstName String
lastName String
badges String[]
role String

  1. Each resource should be in its own Router module (opens new window). Resource collections will be stored as in memory arrays associated with their respective Router module.

  2. Routes related to individual members of a resource collection should use an id validation middleware which will return a properly formatted 404 response with an error message.

  3. Routes related to creating or updating a resource will have a validation middleware which will return a properly formatted 400 response with an error message. Do not trust the id property in the req.body.

  4. Ensure that you write clean and readable code. Pay attention to:

  • no runtime errors
  • consistent 2 space indentation
  • logical grouping of related code
  • semantically descriptive names for variables and functions
  • well organized project folder structure
  • properly formatted package.json file
    • correct project name
    • your author details
  • properly written package.json scripts (dev + start)

# Submit

All work for this assigment should be completed in your private MAD9124 Github Repository that you have shared with me.

Create a commit to include all of your work from today.

Link the local repo to the GitHub repo and sync them up.

Submit the GitHub repo's URL on Brightspace.

TIP

It is a good habit to make a git commit as you complete each logical requirement. This not only tracks your progress, but protects your working code in case you later break it and need to roll back.

Last Updated: 2/16/2023, 7:04:47 PM