๐ŸŒ ExpressJS ยท subject

ExpressJS Introduction to ExpressJS Syllabus

The Introduction to ExpressJS syllabus for ExpressJS in full: 2 chapters and 6 topics, every one listed below, plus 50 Introduction to ExpressJS flashcards with answers.

2Chapters
6Topics
50Flashcards

Introduction to ExpressJS syllabus: all 2 chapters

Expand any chapter to see its topics and sub-topics.

  1. What is ExpressJS?

    3 topics
    • Definition and Purpose
    • History and Evolution
    • Advantages of Using ExpressJS
  2. Setting Up ExpressJS

    3 topics
    • Installing Node.js and npm
    • Creating a Basic Express Application
    • Understanding package.json

ExpressJS Introduction to ExpressJS flashcards โ€” 50 questions with answers

  1. What is ExpressJS?

    ExpressJS (Express) is a minimal, unopinionated, open-source web application framework for Node.js used to build web servers, APIs, and web applications by simplifying routing, middleware, and HTTP handling.

  2. What is the primary purpose of ExpressJS?

    To simplify building web servers and APIs on top of Node.js by providing a thin layer of fundamental web application features (routing, middleware, request/response helpers) without hiding Node.js's core functionality.

  3. What does it mean that Express is 'unopinionated'?

    Express does not enforce a specific project structure, ORM, template engine, or architecture; developers are free to choose their own tools and organize the application however they like.

  4. On what runtime does ExpressJS run?

    Node.js โ€” Express is a framework built on top of Node.js's built-in HTTP module.

  5. Which Node.js core module does Express build upon to handle HTTP?

    The built-in 'http' module; Express wraps and extends its server, request, and response objects.

  6. Who originally created ExpressJS and in what year was it first released?

    TJ Holowaychuk created Express, and it was first released in November 2010.

  7. By what framework was Express inspired?

    Express was inspired by Sinatra, a lightweight web framework from the Ruby ecosystem.

  8. Which organization now stewards/maintains ExpressJS as an open-source project?

    The OpenJS Foundation (Express was previously acquired/backed by StrongLoop, then IBM, before moving to the OpenJS Foundation).

  9. What is Connect, and how does it relate to Express's history?

    Connect is a middleware framework for Node.js; Express was originally built on top of Connect and adopted its middleware architecture, which is why Express middleware works similarly.

  10. What major version of Express introduced native support for async/await error handling and dropped many legacy dependencies, released in 2024?

    Express 5.x, which became the default/stable line in 2024, adds improved async error handling and modernizes the codebase (Express 4.x had long been the standard before it).

  11. List three key advantages of using ExpressJS.

    1) Simple, fast setup of servers and routing; 2) Powerful middleware system for reusable request processing; 3) Large ecosystem and community with extensive third-party packages. (Also: minimal/lightweight, flexible, and template-engine support.)

  12. Why is Express considered 'minimal' or 'lightweight'?

    Its core is small and provides only fundamental web features; additional functionality is added via middleware and npm packages rather than being bundled in, keeping the framework lean.

  13. How does Express's middleware system benefit developers?

    It lets developers plug in reusable functions that process requests/responses in a pipeline (e.g., logging, authentication, parsing, error handling), promoting modular and maintainable code.

  14. Name two popular frameworks built on top of Express.

    NestJS and Sails.js (also LoopBack and older KrakenJS) are built on or heavily use Express.

  15. What is Node.js?

    Node.js is an open-source, cross-platform JavaScript runtime built on Chrome's V8 engine that lets you run JavaScript outside the browser, commonly for server-side and networking applications.

  16. What JavaScript engine powers Node.js?

    Google's V8 JavaScript engine (the same engine used in the Chrome browser).

  17. What is npm?

    npm (Node Package Manager) is the default package manager for Node.js, used to install, manage, and share JavaScript packages/dependencies and to run scripts.

  18. When you install Node.js, what other tool is automatically installed with it?

    npm โ€” the Node Package Manager is bundled with the Node.js installer.

  19. Which commands verify that Node.js and npm are installed and show their versions?

    `node -v` (or `node --version`) for Node.js and `npm -v` (or `npm --version`) for npm.

  20. What tool lets you install and switch between multiple Node.js versions on one machine?

    NVM (Node Version Manager); on Windows, nvm-windows serves the same purpose.

Show the other 30 Introduction to ExpressJS flashcards
  1. What is the difference between the LTS and Current release lines of Node.js?

    LTS (Long-Term Support) releases prioritize stability and receive extended maintenance, recommended for production; Current releases include the newest features but shorter support, suited for testing latest capabilities.

  2. What command initializes a new Node.js project and creates a package.json file?

    `npm init` (interactive) or `npm init -y` to accept all defaults and generate package.json automatically.

  3. What command installs Express into your project and saves it as a dependency?

    `npm install express` (npm automatically saves it to dependencies in package.json; older syntax used `--save`).

  4. Write the minimal code to import Express and create an application instance (CommonJS).

    const express = require('express'); const app = express();

  5. In a basic Express app, what does the `app` object returned by `express()` represent?

    It represents the Express application instance, used to configure middleware, define routes, set settings, and start listening for requests.

  6. Write the code for a basic Express route that responds with 'Hello World' at the root URL.

    app.get('/', (req, res) => { res.send('Hello World'); });

  7. 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.

  8. 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).

  9. 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.

  10. 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.

  11. 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.

  12. 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.

  13. 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`.

  14. 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.

  15. 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.

  16. 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.

  17. 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.

  18. 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`.

  19. 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.

  20. 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.

  21. 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.

  22. 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.

  23. 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.

  24. 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).

  25. 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.

  26. 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.

  27. 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.

  28. 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.

  29. 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`).

  30. 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).

ExpressJS Introduction to ExpressJS FAQ

What is in the ExpressJS Introduction to ExpressJS syllabus?

ExpressJS Introduction to ExpressJS is split into 2 chapters: What is ExpressJS? and Setting Up ExpressJS. Together they contain 6 topics.

How many chapters are in ExpressJS Introduction to ExpressJS?

2 chapters, containing 6 topics. The largest chapter is What is ExpressJS?, with 3 topics.

Are there flashcards for ExpressJS Introduction to ExpressJS?

Yes โ€” a 50-card Introduction to ExpressJS deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.