Skip to content

SI 679 NotebookBackend Development

My study notes for the course, built from lecture notes, readings, and the code we write in class.

About the course โ€‹

SI 679 builds backend web services in TypeScript with Node.js and Express. It starts with a bare HTTP server, then adds routing and middleware, automated tests with Vitest and supertest, a MongoDB database, a layered REST API structure (routes โ†’ controllers โ†’ services โ†’ repositories), and unit tests with mocks and spies.

Weeks โ€‹

PageTopicMain code
Page 0: JS & TS FoundationsJavaScript refresher, TypeScript types, type vs interfacepractice/, TS basics exercise
Week 1: Servers & Express IntroClientโ€“server model, web servers, first Express appWeek 1 in-class server.js
Week 2: Routing, Middleware & TestingExpress routing & middleware, unit testingBooks router, HW1 SliceDrop
Week 3: MongoDB & Testing with a DatabaseMongoDB integration, testing with VitestProducts + MongoDB driver
Week 4: REST APIs & Layered ArchitectureREST API design, project structure in layersREST layers starter
Week 5: Testing (E2E, Unit, Mocks & Spies)Repositories & business logic, custom errors, e2e and unit tests with vi.fn / vi.spyOn/products testing starter

Start MongoDB โ€‹

mongod is the MongoDB server program. It has to be running before your code (or Compass or mongosh) can connect to the database at mongodb://127.0.0.1:27017. Start it in its own terminal and leave that terminal open:

bash
mongod --dbpath ~/data/mdata

--dbpath tells mongod which folder holds the database files. Stop the server with Ctrl+C. To poke at the data from another terminal, run mongosh, then use week3db, then db.products.find(). More in Week 3.

Writing code? The Cheat Sheet collects every pattern on one page: routes, req/res, status codes, middleware, MongoDB CRUD, the layer template, and test setup.

How to use this notebook

Read the Overview and Key concepts first, then open the Code walkthrough next to the linked source file. Try the Review questions before opening the answers.