Skip to content
tezvyn:

Node.js & Express

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

32 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 interview questions in Node.js & Express, page 2

easy1 min read

Unit, integration, and E2E tests explained

Unit tests isolate one function with dependencies mocked, integration tests exercise several units together (route plus DB), E2E tests drive the whole running system.

easy1 min read

Writing a basic Jest unit test

Import the function, group cases with describe, define each case with it or test, assert with expect and a matcher like toBe, covering normal and edge inputs.

easy1 min read

Purpose of Helmet middleware in Express

Helmet sets safe response headers like X-Content-Type-Options, HSTS, and CSP, mitigating MIME-sniffing, clickjacking, and protocol downgrade.

easy1 min read

Preventing XSS when rendering user content in templates

The risk is XSS; default to escaped interpolation (EJS <%= %>, Pug #{}) so HTML is encoded, and avoid raw output (<%- %>) for untrusted data.

easy1 min read

What is a Node.js Stream and why use one

A stream processes data in chunks over time, so memory stays bounded and work starts before all data arrives; ideal for large files and network IO.

easy1 min read

Purpose of the Node.js cluster module

Cluster forks worker processes sharing one listening port, so requests spread across CPU cores via the OS, raising throughput and adding resilience.

easy1 min read

HTTP request-response versus WebSocket connections?

HTTP is request-initiated, pull-based, client waits for response. WebSocket is persistent, bidirectional, either side sends data anytime.

easy1 min read

Socket.IO emit methods: socket, io, broadcast differences?

Socket.emit() sends to one client, broadcast.emit() to all except sender, io.emit() to all.

easy1 min read

How to add Socket.IO to an Express application?

Create HTTP server with express(), attach Socket.IO to it, listen on server not app, define event handlers.

easy1 min read

Environment configuration and secrets management in Node.js?

Use environment variables, load from .env file (dev only), never commit secrets.

easy1 min read

What does PM2 do for Node.js applications?

PM2 restarts crashed processes and manages multiple workers.

easy1 min read

How does NODE_ENV=production change Express behavior?

NODE_ENV is a convention signal, production disables verbose logging and enables caching.

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