Node.js flash cards: Journeyman level

26 Node.js terms at the Journeyman level, as flash cards.

Updated

Terms in this deck

async/await in Node
Writing promise code that reads top to bottom.
Buffer
Holds raw binary data.
Callback
A function run when work finishes; Node's original style.
CORS in Express
Middleware letting other domains call your API.
Error-Handling Middleware
Four-parameter middleware that turns errors into responses.
Event Loop
How Node juggles many tasks on one thread.
EventEmitter
Objects that emit events for listeners.
helmet
An Express middleware package that adds a set of security headers to every answer and removes X-Powered-By.
Job Queue
A line of work waiting to run after the response, one job after another: in memory for work that can be redone, or in a job service such as BullMQ when jobs must survive a restart.
mongodb-memory-server
An npm package that starts a real, throwaway MongoDB server for tests, in a temporary folder on a free port, and stops it afterward.
multer
The Express middleware that reads forms sent as multipart/form-data, saving each uploaded file and putting its details in req.file and the text fields in req.body.
node:test
Node's built-in test runner.
Non-Blocking I/O
Not waiting on files or network, so other work continues.
npm audit
Checks a project's installed packages against a list of known security holes and reports each by severity; npm audit fix updates what it can.
npm ci
Clean install: deletes node_modules and installs exactly the versions package-lock.json records, without changing any file.
package-lock.json
Records exact package versions; commit it.
pino
A fast Node logger that writes each log as one JSON line with a level, a time and any fields you add; pino-http adds a line for every request.
Promises in Node
Objects representing results that arrive later.
Router
Groups related routes, mounted under a path.
Semantic Versioning
MAJOR.MINOR.PATCH version numbers and ranges like ^1.4.0.
Socket.IO
A library on top of WebSockets with rooms and automatic reconnects built in; the page and the server must both use it.
Streams
Processing data piece by piece instead of all at once.
Supertest
A testing package that sends HTTP requests straight to a Node app, such as an Express app, with no server running, and lets a test check the response.
util.parseArgs
Node's built-in function that reads a command's options, such as --runner Leo or -r Leo, with defaults.
Version Range
The versions of a package a project accepts, written in package.json: ^4.21.0 allows any newer 4.x, ~4.21.0 only newer 4.21.x fixes.
ws
The package most Node projects use for WebSockets: a WebSocketServer for the server, and a WebSocket client for Node.

Read them in the glossary