Skip to content
tezvyn:

Node.js & Express

Node.js, Express, Fastify, NestJS, Bun, Deno

70 bites

Test yourself: Top 30 easy Node.js & Express interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Easy everything in Node.js & Express, page 2

easy1 min read

Parse JSON and URL-encoded bodies in Express

Express.json() for JSON, express.urlencoded() for form data, both registered via app.use().

easy1 min read

What is Express middleware

Middleware are functions in a chain with req, res, next, they inspect or modify request and response, then call next to continue or send a response to end.

easy1 min read

Query params vs route params in Express

Query string values via req.query.q, named path segments via req.params.id, query is optional, route params are part of the matched pattern.

easy1 min read

Serving static files in Express

App.use with express.static pointing at the public directory, files served relative to that root, often combined with an absolute path.

easy1 min read

Minimal Express Hello World server

Import express, create an app, define app.get on the root sending a response, call app.listen on a port.

easy1 min read

Minimal HTTP server with the http module

CreateServer with a request listener, set status and Content-Type, end the response, call listen on 3000.

easy1 min read

Why use path.join over string concatenation

Path.join uses the correct OS separator, collapses duplicate slashes, normalizes . and .. segments.

easy1 min read

fs.readFileSync vs fs.readFile

Sync blocks the event loop and returns directly, async takes a callback or promise, only sync is safe at startup.

easy1 min read

The three states of a JavaScript Promise

Pending, fulfilled, rejected; settle is one-way and final; create with the executor calling resolve or reject, consume with then and catch.

easy1 min read

Resolving core vs relative module specifiers

'fs' is a built-in core module loaded by name with top priority; './my-file.js' is a relative path resolved from the current file.

easy1 min read

dependencies vs devDependencies in package.json

Dependencies ship and run in production; devDependencies are only for development; omitted with npm install --production.

easy2 min read

The WebSocket Protocol

WebSocket (RFC 6455) is a protocol providing full-duplex, persistent communication over a single TCP connection. It begins as an HTTP request that upgrades, then both client and server can send messages anytime, enabling real-time apps without HTTP's…

easy2 min read

How does Node.js handle thousands of connections on one thread?

This tests non-blocking I/O: Node.js runs one thread for an event loop while the OS handles sockets via epoll or IOCP, resuming callbacks when data arrives. Mention the thread pool for DNS and fs work. A red flag is claiming threads spawn per request.

easy2 min read

Node.js Built-in SQLite Driver

Node.js bundles a SQLite driver in node:sqlite. Open a file with new DatabaseSync(path), then run SQL with exec() or prepared statements. Use it for local tools and caches. DatabaseSync is synchronous, so running it on a web server main thread blocks requests.

easy2 min read

ODM: Your Database as JavaScript Objects

ODM translates JavaScript objects to database records and back, letting you work with plain objects instead of raw queries. It removes boilerplate in Node.js apps but hides the real queries underneath.

easy2 min read

Node.js Callbacks: Functions That Run Later

A callback is a function you pass to run later when an event fires or work finishes, keeping Node.js free to handle other work. HTTP servers use them to respond to connections without blocking.

easy2 min read

Creating a Basic Node.js Dockerfile

A Dockerfile is a recipe for building a portable image of your app. Use it to ensure your Node.js app runs identically everywhere, from your laptop to production.

PM2: The Process Manager for Production Node.js
easy2 min read

PM2: The Process Manager for Production Node.js

PM2 is a process manager that keeps your Node.js apps online. Use it to automatically restart crashed apps, run them in the background, and scale across CPU cores. The footgun is forgetting to run pm2 save to make your process list survive server reboots.

NODE_ENV: Flipping the 'Production' Switch
easy2 min read

NODE_ENV: Flipping the 'Production' Switch

Setting NODE_ENV=production is like telling your Node.js app it's showtime, not rehearsal. This triggers performance optimizations in frameworks like Express, such as view caching and less verbose errors.

easy2 min read

Socket.IO: Emitting and Handling Events

Socket.IO events are named messages sent between a client and server. One side emits a message, the other listens with on. This powers real-time apps like chat. The footgun: don't JSON.stringify objects; Socket.IO does it for you.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles