Wiring MongoDB into Express

An Express API connects to MongoDB once when the server starts, hands the database to createApp(db), answers 404 when the repository finds no workout, lets a failed database call reach the error-handling middleware, and closes the connection when Ctrl+C stops it.

By

Updated

Cheat sheet: Wiring MongoDB into Express
Category
Node.js
Level
Journeyman
Tags
404 Not Found, Connection Pool, Dependency Injection (oop), Error-Handling Middleware, mongodb, nodejs, rest-api, Signal (unix)