Node.js and REST API Interview Questions: Methods, Status Codes, JWT
Node.js and REST API questions, made simple
Learn the HTTP methods, status codes, middleware, REST vs GraphQL and JWT basics that most backend and full-stack interviews ask, with clear model answers.
If you apply for a full-stack or backend role, you will almost surely be asked how a server talks to a browser or a mobile app. Node.js with Express is a very common way to build this, so interviewers use it to test your basics.
After this lab, you will be able to explain HTTP methods and status codes, describe how middleware works in Express, compare REST with GraphQL, and explain JWT login in simple words.
The big idea: define, detail, prove
A strong technical answer has three parts. Use them for any API question.
Spot the difference
Question: “What is the difference between PUT and PATCH? What status code do you send after creating a user?” Switch between the two answers.
Quick concept check
Tap each card to flip it.
Key concepts, explained simply
An everyday picture first, then the correct technical answer.
const express = require('express');
const app = express();
app.use(express.json()); // middleware: reads the JSON body
app.post('/users', (req, res) => {
if (!req.body.name) return res.status(400).json({ error: 'name is required' });
res.status(201).json({ id: 1, name: req.body.name });
});
// error handler: four arguments
app.use((err, req, res, next) => res.status(500).json({ error: 'Something went wrong' }));
app.listen(3000);
Build your API project answer
Fill the blanks. Your answer writes itself on the right.
Three model answers you can adapt
Three common questions. Each answer follows define, detail, prove.
“When a request reaches an Express app, the middleware runs in the order I added it. For example, express.json() first reads the JSON body, and then my auth middleware checks the token. If all is fine, the matching route handler runs, talks to the database and sends a response with a status code. In my college project, a missing token stopped the request early with 401 Unauthorized, so the route never ran.”
“REST gives each resource its own URL with a fixed response, while GraphQL usually has one endpoint where the client asks for exactly the fields it needs. If different screens need different data from many sources, GraphQL can cut extra requests. If the API is simple and caching matters, REST is easier and works well with normal HTTP caching. In my last team, we kept REST for our public API and used GraphQL for a mobile home screen that pulled data from several services.”
“There is no perfect place, so I explain the trade-off. localStorage is easy, but any script on the page can read it, so an XSS bug could steal the token. An httpOnly cookie cannot be read by JavaScript, which helps against XSS, but then I must protect against CSRF, for example with SameSite cookies. In my project, I used short-lived access tokens with a refresh token in an httpOnly cookie.”
Four mistakes that cost you the round
Test yourself
Question 1 of 5
Rehearse before the real thing
Press start and answer one question out loud, like “What is middleware?”. Use define, detail, prove and try to finish within 90 seconds.
- 1POST creates, PATCH updates
- 2401 = log in, 403 = not allowed
- 3Middleware: next() or respond
- ★JWT is signed, not encrypted
Screenshot it. Save it. Share it.
Keep this card on your phone and look at it five minutes before your interview.
Quick answers
Do I need to learn Express for Node.js interviews?
Most Node.js backend jobs use a framework, and Express is the usual one to learn first. Knowing its routing and middleware also makes it easier to pick up others like Fastify or NestJS.
What is the difference between authentication and authorization?
Authentication checks who you are, like logging in. Authorization checks what you are allowed to do, like opening admin pages. Failing the first usually means 401; failing the second means 403.
Is GraphQL replacing REST?
No. Both are widely used. REST is simple and fits most create, read, update and delete APIs. GraphQL helps when many clients need different shapes of data. Many companies use both.
How should I prepare for a live API coding round?
Practise building a small CRUD API with Express in under 30 minutes: routes, input checks, correct status codes and an error handler. Test it with Postman or curl and explain your choices out loud.

One Comment