• 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 10: Jobs API Part 2

Lesson Materials

In this lesson, you complete implementation of the CRUD operations for the Jobs API, testing with Postman as you go. Your Postman configuration should have globals for the URL and, as the instructor explains, the accessToken. You improve the error handling to return meaningful error messages to the user when Mongoose validation errors occur. You then add security protection for the application so that it can be deployed on the Internet. The security configuration uses the following node packages:

  • helmet
  • cors
  • xss-clean
  • express-rate-limit

These packages must be used whenever you deploy an application publicly, to minimize the chance of a security exposure. For your class final project, you will use these same packages, because you will deploy your final project on the Internet, and you want it to be secure.

As for previous lessons, you duplicate the work that the instructor shows. You continue to put your work in the new 06-jobs-api repository. If you get stuck, answers are 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 week10 git branch, which should be created when the week9 git branch is active. This lesson runs from 8:20:55 to 9:34:54 of this video.

The instructor shows how to deploy to Heroku. However, since this video was made, Heroku has announced that they are ending free access for deploying web applications. Therefore, do not install the Heroku CLI, and do not deploy to Heroku. Instead, you deploy your application to Render.com. Instructions are below.

Assignments

Coding Assignment

Be sure you test each step with Postman, creating a Postman collection of tests just like the instructor is doing.

Deploying to Render.com: You deploy your application once you have your assignment completed and working, and once you have pushed your week10 branch to Github.

To deploy to Render.com, follow these steps:

  1. Greate a Render.com account. You do not need to install anything on your workstation for Render deployment. You do not need to enter any credit card information.
  2. From your Render.com dashboard, click on the New button in the upper right. Select Web Service. Your are then prompted you to connect a repository. Scroll down to the entry field that says public git repository, and enter the URL of your 06-jobs-api repository. Then press continue.
  3. The next page prompts you for the name of the service. This becomes the first part of the URL for your application. You need to give it a unique name that no one else is using, maybe something like jobs-api-437.
  4. Scroll down to the entry field for branch. Put in week10.
  5. Scroll down until you see the “advanced” button. Click on that. You then click on Add Environment Variable. You need to add an environment variable for each of the values in your .env file: the Mongo URI, the JWT key, and so on.
  6. Scroll to the bottom and click on Create Web Service. Render.com then builds the application for deployment. The process takes a while. Once the process completes, you see a link in the upper right for your new web service. The URL will be something like https://jobs-api-437.onrender.com.
  7. Copy that URL and put it into your Postman tests for the assignment. Then test with Postman. Your application is live!

Swagger: The section of the video from 9:34:54 to the end discusses setting up a Swagger configuration. When you have an API, you need to document it so that implementers of applications that call the API know what the operations are. Swagger is the best way to do that. It also creates a graphical user interface so that one can call the APIs directly from the UI. You should watch this section so that you understand how a Swagger configuration may be created and what functions it provides. However, this section of the video is complicated and confusing, so unless you are very brave, you probably don’t want to try to implement Swagger for your application.

Mindset Assignment

Your mindset assignment for this week can be found here: Problem Solving

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 week10 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