Step 1: Starter

The starter code is in the same repository where the completed program is. To get the starter, you should switch to the starter branch.

Please close the starter branch as follows:

git clone -b starter https://github.com/cs280fa22/14-roster-api

Notice the -b starter in the command.

MongoDB Connection

Next, head over to MongoDB Atlas and Create a MongoDB Cluster.

Then, create a .env in the root folder. Store your MongoDB connection URI in a variable DB_URI in the .env file. Finally, add a DB_TEST_URI to the .env using the same connection URI but a different database name.

Install Dependencies

Open the terminal at the root of the repository. Then, install dependencies with yarn install.

Open the package.json file and review the project dependecies, in particular the following packages:

  • cors adds Access-Control-Allow-Origin: * to response headers to allow for "Cross-Origin Resource Sharing".

  • helmet adds a dozen of other response headers to follow good security practices in designing REST HTTP APIs.

  • prettier is a code formatter; you can run it with yarn prettier to format your code.