Skip to content
tezvyn:
Menu

⚙️Backend Dev

Backend engineering, APIs, and databases

534 bites

Test yourself: Top 30 intermediate Backend Dev interview questions →Multiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Intermediate everything in Backend Dev, page 4

intermediate1 min read

Propagating async errors to Express error handlers

Express does not auto-catch rejected promises, so catch and call next(err), or wrap handlers in an asyncHandler that forwards rejections; Express 5 awaits handlers automatically.

intermediate1 min read

Securing Express with Passport local strategy

Configure LocalStrategy with a verify callback, call passport.authenticate as route middleware, and set up serializeUser/deserializeUser for sessions.

intermediate1 min read

Session-based versus token-based authentication

Sessions store server-side state with a cookie id, tokens carry self-contained claims with no server store, weigh revocation versus scalability, especially across services.

intermediate1 min read

Mongoose pre('save') hooks for password hashing

Pre('save') runs before persistence; use it to hash the password, guarding with isModified, calling next() or returning.

intermediate1 min read

Database migrations with the Sequelize CLI

Migrations are version-controlled scripts with up/down so teams apply identical schema changes; use sequelize-cli to generate, edit with addColumn, then db:migrate.

intermediate1 min read

Mongoose populate() for referenced documents

Populate() replaces stored ObjectIds with the referenced documents, needs a ref in the schema, called via .populate('author').

intermediate1 min read

404 vs 500: missing resource vs server failure

A missing resource returns 404 Not Found (client asked for something absent); a database failure returns 500 Internal Server Error (server-side fault).

intermediate1 min read

Idempotency: PUT vs POST in REST

Idempotent means repeated identical requests leave the same server state; PUT is idempotent, POST is not. Use PUT to overwrite a resource at a known URL.

intermediate1 min read

Modularize routes with express.Router

Create a Router per resource in its own file, define routes on it, export it, and mount with app.use('/products', router).

intermediate1 min read

Middleware execution order and sharing data via req

Middleware runs top-down in registration order; each calls next(); attach data like req.user that later handlers read.

intermediate1 min read

Express error-handling middleware signature

(err, req, res, next) with err first, identified by arity, placed last after all routes.

intermediate1 min read

Application-level vs router-level middleware

App.use() binds to the app and runs everywhere; router.use() binds to a Router and runs only for that router's routes.

intermediate1 min read

Express route order and matching

Express checks routes in definition order, /items/new matches the literal route first, if /:id came first new would be captured as an id.

intermediate1 min read

res.send vs res.json vs res.end

Send is flexible and sets content type by type, json serializes and sets JSON content type, end is the raw http terminator with no body helpers.

intermediate1 min read

Parsing JSON bodies with express.json

Register express.json via app.use so it reads the request stream and populates req.body before handlers run, place it before routes.

intermediate1 min read

fs.watch vs fs.watchFile

Watch uses OS event notifications, efficient but inconsistent across platforms, watchFile polls stat at an interval, reliable but slower.

intermediate1 min read

path.resolve vs path.join

Join concatenates and normalizes relative segments, resolve builds an absolute path right to left from cwd and resets on any absolute segment.

intermediate1 min read

Reading a POST body from the request stream

Body arrives in chunks via data events, accumulate them, on the end event concatenate and JSON.parse inside try/catch.

intermediate1 min read

Counting lines in a 5GB log file efficiently

ReadFile loads all 5GB into RAM and may exceed buffer limits, instead stream with createReadStream plus readline and count line by line.

intermediate1 min read

Comparing the three async error-handling styles

Callbacks pass err as first arg; Promises route errors to catch; async/await uses try/catch; an unhandled rejection can crash the Node process.

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