• 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

Welcome to the Code the Dream’s first ever Node/Express class, Alpaca!

Node, short for Node.js, is an implementation of the Chrome JavaScript engine, but one that runs outside of the browser, so that it can be used to write standalone programs as well as web serving applications. Express is a framework for Node that makes the creation of web applications very easy. These are complemented by a vast library of NPM packages to make adding common functions easy. The combination is a leading framework throughout the IT industry, and continues to grow in adoption. And, all programming in Node and Express is in JavaScript, so the back end engine for an application can be written in the same language as the front end.

Remember you can always use your class discussion channel (#alpaca-discussion) if you need help throughout this course. The Student Resources page also has links to git cheat sheets, documentation and more.

Course Calendar

WeekStart DateDue DateLessons
Pre-Class06/01/202206/07/2022Machine Setup
Github Cookbook
Week 106/08/202206/14/2022Node Introduction
Week 206/15/202206/21/2022NPM and Async Patterns
Week 306/22/202206/28/2022Introduction To Express
Week 406/29/202207/05/2022Middleware, REST Methods, and Postman
Week 507/06/202207/12/2022Task Manager API Part 1
Week 607/13/202207/19/2022Task Manager API Part 2
Week 707/20/202207/26/2022Using Query Parameters
Week 807/27/202208/02/2022JWT Basics
Week 908/03/202208/09/2022Jobs API Part 1
Week 1008/10/202208/16/2022Jobs API Part 2
Week 1108/17/202208/23/2022Catch Up Week
Mindset Assignment Link
Week 1208/24/202208/30/2022A Front End for the Jobs API
Week 1308/31/202209/06/2022Server Side Rendering with EJS
Week 1409/07/202209/13/2022Authentication with Passport
Week 1509/14/202209/20/2022Testing with Mocha and Chai
Week 1609/21/202209/27/2022Final Project Begins
Mindset Assignment Link
Week 1709/28/202210/04/2022Final Project Completed
Week 1810/05/2022 to
10/07/2022
Time TBDFinal Project Presentations

For the final project, each student implements an Express application that includes authentication and CRUD operations to a MongoDB database. The application may be implemented as APIs plus a front end (full stack) or using Server Side Rendering with EJS templates. The rubrics for each are below:

Rubric for Express Full Stack

Rubric for Express Server Side Rendering

On Structuring Your Final Project

Code for the Express final project should be organized in the following way: There should be the following directories:

  • models
  • routes
  • controllers
  • middleware
  • db

In addition, server side rendering projects should have views/pages and views/partials. Some projects may have static pages, which should be in the public directory. For both back end and server side rendering projects, there should be error handling, page not found, and authentication middleware. You should have a .env file with project secrets such as the database URI with the password, the JWT secret if JWT is used, and the session secret for server side rendering. Again, never put these secrets in the code, and make sure .env is in your .gitignore file before you push your project to Github.

A sample project that is organized in this way is here. The lessons on server side rendering and passport did not follow this organization model — although I may fix this for subsequent classes. The example linked above does use server side rendering and passport, so this example is particularly important for people doing server side rendering projects. Note that the bcrypt functions are moved into the User model. Note also that the comparePassword function provided is not asynchronous, as it is for the Jobs API project, because Passport can’t call an asynchronous function. Instead we use callbacks. The example I provide does not include partials, although it probably should.

The example also is not secure for Internet deployment. We haven’t talked about that much, but I hope to remedy that with additional material I will post.

This project organization is not strictly required for final projects but it is strongly recommended.

I also have added two new packages, eslint and prettier. Eslint finds syntax errors, where the code may work but really isn’t written right. Prettier reformats the code so that it looks more readable. I have configured these with .eslintrc.json and .prettierignore. These packages are part of the standard build process for production Express applications. You do not have to use them, but you may find them useful, and you should learn to use them eventually. You can run eslint on the sample package with:

npx eslint .

to find syntax errors you need to fix, and you can run prettier as follows:

npx prettier . --write

The prettier command above actually rewrites the files to make them look more readable. As it rewrites everything, you should do your prettier operation in a separate branch, which you then test and merge into the main branch.

Footer

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