• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Code The Dream School
Code the Dream Labs Logo

Code The Dream School

Main hub for class materials for Code the Dream’s classes

  • Code the Dream Home

Search Code The Dream School

CTD Node/Express Class Lesson 9: Jobs API Part 1

Lesson Materials

In this lesson, you register users into a MongoDB database, storing the user name, email, and the hashed password. We never store passwords in plain text. Instead they are cryptographically hashed so that even if the database is compromised, the passwords are not. You create, in addition to the user register route, a user logon route. Each of these routes returns a JWT token, which is used to authenticate requests for the Jobs API. You learn also about extending the mongoose schema with schema methods for password hashing, password compare, and JWT token creation. You then set up the Jobs schema. There is an association between jobs and users, in that each job entry belongs to a particular user, and only that user that owns the job entry can perform CRUD operations on it. The final step in this lesson is actually to create such a job entry. This is only an API, so all testing must be done using Postman.

This lesson runs from 6:28:50 to 8:20:55 of this video. Read the Coding Assignment Instructions before watching the video so you know how your assignment will differ from the video instructions.

As for previous lessons, you duplicate the work that the instructor shows. One annoying thing about this video is that the sound is out of sync with the video, lagging behind for about 5 seconds, but it isn’t a big problem.

Assignments

Coding Assignment

There is a new repository for this lesson. It is here. This is because you will eventually deploy the repository to a cloud service so that it runs on the Internet. The instructor has you do the work in the node-express-course/06-jobs-api/starter directory, and then copy that entire directory tree to a folder outside of node-express-course, and then do a git init. That is complicated and messy. So we have this new repository instead. It is just a copy of the starter directory, but in its own repository. So, fork this repository and then clone your fork. When you clone, make sure you are not in the node-express course tree, so that you keep this repository separate. You will do your work in this new 06-jobs-api repository directory. If you get stuck, answers are in the old repository, in the node-express-course/06-jobs-api/final directory, but please try to do your own work. Before you start this lesson, you create the week9 git branch. Do not do the copy of the starter directory that is described by the instructor. Do not do the git init.

Be sure you test each step with Postman, creating a Postman collection of tests just like the instructor is doing. This Postman collection of tests is used not only to test the API as it runs on your machine, but also, in Lesson 10, to test the application as deployed to Heroku.

Mindset Assignment

Your mindset assignment for this week can be found here: Information Literacy

Submitting Your Work

When you are done, do the following, use the same procedure as for previous lessons. You do a git add, git commit, and git push for the week9 branch, create your pull request on github, and put a link to your pull request in your assignment submission form below.

When you’ve completed your Coding Assignment and Mindset Assignment this week, submit all of your work using:

Alpaca class use:Squibby 2.0 Assignment Submission Form
Baboon and any 2023 classes use:Homework Assignment Submission Form

Footer

Copyright © 2025 Code the Dream School | All Rights Reserved | Privacy Policy