You are going to build a Pokémon API with Node, Express, and MongoDB. Your API will allow users to perform CRUD operations on each of the 151 original Pokémon, and power a front-end.
This document details how to create a recording of your screen.
- Mac
- PC
- Linux NOTE: Recording several hours of screen capture will use a large amount of data, up 4GB PER HOUR. Please make sure you have enough free storage space to accommodate your screen capture data!
- Launch QuickTime Player from Finder or Alfred/Spotlight.
- In QuickTime Player, go to the
File -> New screen recording
- Click the down arrow next to the record button and enable
Show Mouse Clicks in Recording
- Click the red record button to initiate the screen recording
- QuickTime will show you a notice in the middle of the screen as show in the screen shot below -- click on it confirm the screen capture and begin recording To check that QuickTime is actively recording, look for the black stop button (square) inside a circle, in the system tray:
Open QuickTime Player by clicking the the black stop button (square inside a circle) in the system tray
Choose File -> export
, choose 480p quality, and name your video file firstname-lastname-yyyy-mm-dd
Download and install OBS Classic. It's free and open source!
Update the following Settings (click Apply
between each step):
Encoding | Broadcast Settings |
---|---|
Max Bitrate (kb/s): 192 | Mode: File Output Only |
File Path: firstname-lastname-yyyy-mm-dd.mp4 | |
Video: FPS: 15 | |
Add a Monitor Capture source: |
- Right click the
Sources:
box and clickAdd -> Monitor Capture
- Give it any name, the default is fine
- Click
OK
, the default options are fine From the main screen, clickStart Recording
, and minimize the program.
Simply click Stop Recording
and your screen recording will show up at the File Path
you specified.
We recommend SimpleScreenRecorder
npm install
npm start
npm test
In addition to your frequent commits, make a commit after completing each of the following steps (marked by check boxes), indicating that you have just completed it. It may not be the case that you have time to complete all of the following steps, but regardless, you must work on them in order (though there is an escape hatch for the back-end if you need).
- Back-end
- Front-end
- Middleware
- Testing
Pro tip: Install and use Postman to test your API routes for this section
Using the existing code provided in server/
, follow the steps below to build out a Pokémon API:
URL | HTTP Verb | Request Body | Result |
---|---|---|---|
/api/pokemon | GET | empty | Respond with JSON of all Pokémon |
/api/pokemon | POST | JSON | Create new Pokémon and respond with JSON of created Pokémon |
/api/pokemon | DELETE | empty | Delete all Pokémon in database and respond with JSON of deleted Pokémon |
/api/pokemon/:number | GET | empty | Respond with JSON of single Pokémon with matching number |
/api/pokemon/:number | PUT | JSON | Update Pokémon with matching number and respond with JSON of updated Pokémon |
/api/pokemon/:number | DELETE | empty | Delete Pokémon with matching number and respond with JSON of deleted Pokémon |
- [ x] Connect Mongoose to your local Mongo database in
db/index.js
- [ x] Create a Pokémon model in
resources/pokemon/Pokemon.js
and register it with Mongoose as thePokemon
collection with the following properties:- [x ]
number
, a unique number - [ x]
name
, a unique string - [ x]
types
, an array of strings - [ x]
imageUrl
, a string
- [x ]
- In
insertAllPokemon.js
, write a function that can populate your Mongo database with the 151 original Pokémon found indata/pokemon.json
, then run the script/invoke the function so that the database is populated. - Complete the controller in
resources/pokemon/pokemonController.js
that interacts with your Pokémon model. - Create a router in
resources/pokemon/pokemonRouter.js
that utilizes each of your controller's methods. Be sure to handle errors appropriately! - Import
pokemonRouter
intoserver.js
and assign it to the correct route - Write at least two tests in
test/api-spec.js
that will help assure future developers that the API is working as intended.
Escape hatch: If you have a showstopping bug in your server, mock it out with json-server. You'll have to change the structure of
data/pokemon.json
slightly to make this work.
Inside of client/
, implement a single page front end to interact with this API using either Angular or React. There is a webpack config file already set up if you are choosing react - please read the webpack.config.js
carefully before starting.
Your front end should be served from Express and should allow the user to:
- Display all Pokémon (with their images)
- Add a new Pokémon
- Filter Pokémon based on their type (but NOT on other properties)
Important: You must complete all of the steps in back-end before moving onto this section.
Inside of server/middleware/rateLimiter.js
, create a custom middleware function in which you implement rate limiting for your API with the following guidelines.
- Require each request to
/api/pokemon
to include aUser
property in the header - Only allow a single user to make 100 requests per hour
- Mount your middleware in an appropriate location in
server/server.js
- Update your front-end to send
user
property with each request
You may visit each of these resources directly, or search for them on Google with the site:
operator:
- MDN
- Express docs
- Mongo docs
- Mongoose docs
- React docs
- Angular docs
- Webpack docs
- Official documentation for any npm package that you install