🌍 ExpressJS · flashcards
ExpressJS Introduction to ExpressJS Flashcards
50 question-and-answer cards covering Introduction to ExpressJS as it is examined in ExpressJS. 24 of them are printed below, taken from across the deck — no signup, no paywall on the preview.
24 sample cards from the Introduction to ExpressJS deck
Sampled from the end of the deck, so these are different cards from the ones shown on the syllabus page.
What method starts an Express server listening on a given port, and how is it used?
`app.listen(port, callback)` — e.g., `app.listen(3000, () => console.log('Server on port 3000'));` It binds the server to the specified port.
In an Express route handler `(req, res) => {}`, what do `req` and `res` stand for?
`req` is the request object (incoming HTTP request data: params, query, body, headers) and `res` is the response object (used to send back the HTTP response).
What is the difference between `res.send()` and `res.json()` in Express?
`res.send()` sends a response of various types (string, buffer, object) and sets Content-Type automatically; `res.json()` explicitly sends a JSON response, converting the argument with JSON.stringify and setting Content-Type to application/json.
What HTTP methods correspond to the Express routing methods app.get, app.post, app.put, and app.delete?
They map directly to the HTTP methods GET, POST, PUT, and DELETE, respectively, for handling those request types on a given path.
What is middleware in Express, and what is a middleware function's typical signature?
Middleware is a function that has access to the request and response objects and the next function in the request-response cycle; its signature is `(req, res, next) => {}`, and it calls `next()` to pass control to the next middleware.
What does calling `next()` do inside Express middleware?
It passes control to the next middleware function in the stack; omitting it (without ending the response) leaves the request hanging.
Which built-in Express middleware parses incoming JSON request bodies?
`express.json()` — added via `app.use(express.json());` it parses JSON payloads and populates `req.body`.
Which built-in Express middleware serves static files such as images, CSS, and HTML?
`express.static()` — e.g., `app.use(express.static('public'));` serves files from the specified directory.
What method mounts middleware or a router in Express so it runs for requests?
`app.use()` — it registers middleware (optionally scoped to a path) into the application's request-processing pipeline.
What is package.json?
package.json is a JSON manifest file at the root of a Node.js project that describes the project's metadata (name, version), dependencies, scripts, and configuration; it makes the project reproducible and shareable.
What is the difference between 'dependencies' and 'devDependencies' in package.json?
'dependencies' are packages required to run the application in production; 'devDependencies' are packages needed only during development/testing (e.g., testing tools, bundlers, nodemon) and are not needed at runtime.
How do you install a package as a devDependency with npm?
`npm install <package> --save-dev` (or the shorthand `-D`), e.g., `npm install nodemon -D`.
What does the 'scripts' field in package.json do?
It defines named command-line shortcuts (e.g., start, test, dev) that can be run with `npm run <name>` (or `npm start`/`npm test` for special names) to execute build, run, or test commands.
Which two fields are the only strictly required fields in a valid package.json?
`name` and `version` are the two required fields; all others are optional.
What is the purpose of the 'main' field in package.json?
It specifies the primary entry point file of the package/module (e.g., 'index.js') that is loaded when the package is required/imported.
What is the difference between package.json and package-lock.json?
package.json lists the project's declared dependencies and metadata with version ranges; package-lock.json records the exact, fully resolved version tree of every installed package to guarantee reproducible installs across machines.
In semantic versioning (semver), what do the three numbers in a version like 4.18.2 represent?
MAJOR.MINOR.PATCH — MAJOR (4) for breaking changes, MINOR (18) for backward-compatible new features, and PATCH (2) for backward-compatible bug fixes.
In a package.json dependency version, what do the caret (^) and tilde (~) prefixes mean?
`^` allows updates that do not change the leftmost non-zero digit — i.e., minor and patch updates (e.g., ^4.18.2 → <5.0.0); `~` allows only patch-level updates (e.g., ~4.18.2 → <4.19.0).
What folder does npm create to store installed packages, and how is it usually handled in version control?
The `node_modules` folder; it is typically excluded from version control via .gitignore because it can be regenerated with `npm install` from package.json/package-lock.json.
What command reinstalls all dependencies listed in an existing package.json?
`npm install` (with no package name) reads package.json/package-lock.json and installs all listed dependencies into node_modules.
How does Express compare to using Node.js's raw 'http' module directly?
Raw http requires manually parsing URLs, methods, and bodies and writing verbose boilerplate; Express adds high-level routing, middleware, and response helpers that drastically reduce boilerplate while still running on the http module underneath.
How does Express differ from a full-stack framework like NestJS?
Express is minimal and unopinionated (you assemble your own structure), whereas NestJS is opinionated, provides a built-in architecture (modules, controllers, dependency injection), and is often built on top of Express itself.
What is a route parameter in Express, and how is it defined and accessed?
A route parameter is a named URL segment for capturing values; it is defined with a colon (e.g., `/users/:id`) and accessed via `req.params` (e.g., `req.params.id`).
What is the difference between a route/query parameter accessed via req.query versus req.params?
`req.params` holds named route segments from the URL path (e.g., :id in /users/:id), while `req.query` holds the parsed query-string values after the '?' (e.g., ?sort=asc → req.query.sort).
What this deck covers
The Introduction to ExpressJS deck follows the ExpressJS Introduction to ExpressJS syllabus — 2 chapters and 6 topics — so questions land on material that is genuinely examinable rather than trivia around it. That works out to roughly 25.0 cards per chapter.
Answers are written to be recallable, not just readable — averaging about 166 characters, which is long enough to carry the reasoning and short enough to say out loud.
A deck like this earns its keep on the second and third pass. Read the syllabus first so you know the shape of the subject, then use the cards to find the specific facts that have not stuck.
Introduction to ExpressJS flashcards FAQ
How many Introduction to ExpressJS flashcards are in this ExpressJS deck?
50 cards. This page previews 24 of them, sampled evenly across the deck so you can judge the difficulty before installing anything.
Are these ExpressJS flashcards free?
Yes. The preview here is free to read with no signup, and the full 50-card deck is free inside the Examius app.
What do the Introduction to ExpressJS cards cover?
They follow the ExpressJS Introduction to ExpressJS syllabus — 2 chapters and 6 topics — so the questions track what is actually examinable.
How should I use these flashcards?
Read the syllabus first so you know the shape of the subject, then drill the deck. Examius schedules each card with spaced repetition, so cards you keep missing come back sooner and ones you know drift further apart.