Easy everything in Node.js & Express
How does NODE_ENV=production change Express behavior?
NODE_ENV is a convention signal, production disables verbose logging and enables caching.
What does PM2 do for Node.js applications?
PM2 restarts crashed processes and manages multiple workers.
Environment configuration and secrets management in Node.js?
Use environment variables, load from .env file (dev only), never commit secrets.
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.
Socket.IO emit methods: socket, io, broadcast differences?
Socket.emit() sends to one client, broadcast.emit() to all except sender, io.emit() to all.
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.
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.
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.
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.
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.
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.
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.
Basic presence validation on a POST login route
Ensure the JSON body parser runs, destructure email and password from req.body, return 400 early if either is missing, then proceed.
JWT structure and how the signature works
Name header, payload, and signature, note the first two are base64url-encoded not encrypted, explain the signature is computed over header and payload with a secret to detect tampering.
Authentication versus authorization in Express
Authentication proves who you are, authorization decides what you may do, authentication happens first.
Define a Mongoose schema and model
New mongoose.Schema with field options (type, required, default), then mongoose.model('Product', schema) to get a model.
Status codes for successful POST and GET
201 Created for a successful POST (ideally with a Location header), 200 OK for a successful GET returning data.
req.params vs req.query vs req.body in Express
Req.params holds named route segments, req.query holds the URL query string, req.body holds the parsed payload.
Design an Express route to create a user
POST to a collection URL like /users, read the payload from req.body via express.json(), return 201 with the created resource.
Write a request-logging middleware in Express
Read req.method, log with a timestamp, then call next() to continue.
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