Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Express allows multiple middleware functions to run sequentially for a request. Each calls next() to pass control to the next middleware. app.use((req, res, next) => { console.log('Middleware 1'); next()…
Short answer: Clustering runs multiple Node.js instances on different CPU cores sharing the same server port. This spreads load and uses full CPU capacity, increasing concurrency. Real-world example (ShopNest) A ShopNest…
Short answer: pp.use((req, res, next) => { console.log('Middleware 1'); next(); }); pp.use((req, res, next) => { console.log('Middleware 2'); res.send('Done'); }); pp.use((req, res, next) => { console.log('Middl…
Short answer: dependencies: These are required for your app to run in production. 📌 Example code express, mongoose devDependencies: Only needed during development (testing, building, linting). 📌 Example: nodemon, eslin…
Short answer: Node.js uses a single-threaded event loop to handle many I/O operations asynchronously, allowing it to handle thousands of concurrent connections efficiently without creating threads per connection. Real-wo…
Short answer: Deploy multiple instances on different machines or containers. Use a load balancer to distribute traffic. Share state externally (e.g., Redis) since instances are stateless. Say this in the interview Define…
Short answer: llowing it to handle thousands of concurrent connections efficiently without creating threads per connection. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for th…
Short answer: Semantic Versioning (semver) is a versioning system that uses the format: MAJOR.MINOR.PATCH Example: 2.5.3 MAJOR: Breaking changes MINOR: New features, no breaking changes PATCH: Bug fixes, backwards-compat…
Short answer: Global variables holding references. Event listeners not removed. Closures holding onto variables. Caches growing without limits. Security & Best Practices Real-world example (ShopNest) A ShopNest BFF i…
Short answer: The cluster module lets you fork your Node.js process to create worker processes that share the same server port, improving CPU utilization. Testing Node.js Applications Real-world example (ShopNest) A Shop…
Short answer: To update all packages to their latest safe versions based on semver: npm update To update a specific package to its latest version: npm install express@latest For a more interactive way: npx npm-check-upda…
Short answer: You can create a custom module by writing logic in a separate .js file and exporting it using module.exports. Explain a bit more 📌 Example: mathUtils.js function add(a, b) { return a + b; module.exports =…
Short answer: Use rate limiting. Validate and sanitize inputs. Avoid blocking event loop. Use security middleware like helmet. Use a reverse proxy with DDoS protection. Real-world example (ShopNest) A ShopNest BFF in Nod…
Short answer: pp.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js. REST API Deve…
Short answer: Ensuring incoming data matches expected format to avoid injection attacks, crashes, or invalid data storage. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for the…
Short answer: React is a JavaScript library for building user interfaces, mainly for single-page applications. Explain a bit more It uses standard HTTP methods to perform CRUD operations on resources, which are typically…
Short answer: REST (Representational State Transfer) is an architectural style for designing networked applications. Explain a bit more It uses standard HTTP methods to perform CRUD operations on resources, which are typ…
Short answer: Strip out dangerous characters. Use libraries like validator.js. Escape output in HTML contexts. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs for the React store…
Short answer: RESTful APIs use the following standard HTTP methods: Method Purpose GET Retrieve data POST Create new data PUT Update existing PATCH Partial update DELETE Remove data Real-world example (ShopNest) A ShopNe…
Short answer: Cross-Origin Resource Sharing controls which domains can access your API. Configure with the cors package: const cors = require('cors'); app.use(cors({ origin: ' })); Real-world example (ShopNest) A ShopNes…
Short answer: Name commonly used ones. HTTP status codes indicate the result of a request: Code Meaning 200 OK 201 Created 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 📌 Example…
Short answer: pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.…
Short answer: HTTP status codes indicate the result of a request: Code Meaning 200 OK 201 Created 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 📌 res.status(201).json({ message:…
Short answer: Using Express.js, you can quickly set up routes and logic. 📌 Example: const express = require('express'); const app = express(); app.use(express.json()); app.get('/api/users', (req, res) => { res.json([…
Short answer: Validate file types and sizes. Store files outside of the web root. Use libraries like multer. Scan files for malware. REST API & Web Development Real-world example (ShopNest) A ShopNest BFF in Node.js…
Node.js Node.js Tutorial · Node.js
Short answer: Express allows multiple middleware functions to run sequentially for a request. Each calls next() to pass control to the next middleware. app.use((req, res, next) => { console.log('Middleware 1'); next(); }); app.use((req, res, next) => { console.log('Middleware 2'); res.send('Done'); });
Express middleware authenticates JWT, then the /orders route handler creates the order.
Node.js Node.js Tutorial · Node.js
Short answer: Clustering runs multiple Node.js instances on different CPU cores sharing the same server port. This spreads load and uses full CPU capacity, increasing concurrency.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: pp.use((req, res, next) => { console.log('Middleware 1'); next(); }); pp.use((req, res, next) => { console.log('Middleware 2'); res.send('Done'); }); pp.use((req, res, next) => { console.log('Middleware 1'); next(); }); pp.use((req, res, next) => { console.log('Middleware 2'); res.send('Done'); }); pp.use((req, res, next) => { console.log('Middleware 1');… next(); }); pp.use((req, res, next) => {…
console.log('Middleware 2'); res.send('Done'); }); pp.use((req, res, next) => { console.log('Middleware 1'); next(); }); pp.use((req, res, next) => { console.log('Middleware 2'); res.send('Done'); });
Express middleware authenticates JWT, then the /orders route handler creates the order.
Node.js Node.js Tutorial · Node.js
Short answer: dependencies: These are required for your app to run in production. 📌
express, mongoose devDependencies: Only needed during development (testing, building, linting). 📌 Example: nodemon, eslint, jest 📦 These are defined in package.json: "dependencies": { "express": "^4.18.0" }, "devDependencies": { "nodemon": "^3.0.0" } ✅ Install a dev dependency with: npm install nodemon --save-dev
Node.js Node.js Tutorial · Node.js
Short answer: Node.js uses a single-threaded event loop to handle many I/O operations asynchronously, allowing it to handle thousands of concurrent connections efficiently without creating threads per connection.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Deploy multiple instances on different machines or containers. Use a load balancer to distribute traffic. Share state externally (e.g., Redis) since instances are stateless.
Node.js Node.js Tutorial · Node.js
Short answer: llowing it to handle thousands of concurrent connections efficiently without creating threads per connection.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Semantic Versioning (semver) is a versioning system that uses the format: MAJOR.MINOR.PATCH Example: 2.5.3 MAJOR: Breaking changes MINOR: New features, no breaking changes PATCH: Bug fixes, backwards-compatible 📌 Example: If a package moves from 1.2.0 to 2.0.0, it likely has breaking changes. In package.json, you might see: "express": "^4.17.1" ^ means it can auto-update minor and patch versions, but not major ones.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Global variables holding references. Event listeners not removed. Closures holding onto variables. Caches growing without limits. Security & Best Practices
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: The cluster module lets you fork your Node.js process to create worker processes that share the same server port, improving CPU utilization. Testing Node.js Applications
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: To update all packages to their latest safe versions based on semver: npm update To update a specific package to its latest version: npm install express@latest For a more interactive way: npx npm-check-updates -u npm install ✅ The npm-check-updates tool helps update versions in your package.json.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: You can create a custom module by writing logic in a separate .js file and exporting it using module.exports.
📌 Example: mathUtils.js function add(a, b) { return a + b; module.exports = { add, subtract }; app.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js. REST API Development in Node.js
} function subtract(a, b) { return a - b;
}
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Use rate limiting. Validate and sanitize inputs. Avoid blocking event loop. Use security middleware like helmet. Use a reverse proxy with DDoS protection.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: pp.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js. REST API Development in Node.js pp.js const math = require('./mathUtils'); console.log(math.add(5, 3)); // 8 console.log(math.subtract(9, 4)); // 5 ✅ This is how you break your code into reusable pieces (modules) in Node.js.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Ensuring incoming data matches expected format to avoid injection attacks, crashes, or invalid data storage.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: React is a JavaScript library for building user interfaces, mainly for single-page applications.
It uses standard HTTP methods to perform CRUD operations on resources, which are typically represented as URLs. ✅ A RESTful API allows different systems (like frontend apps or mobile apps) to interact with your server over HTTP in a stateless manner. 📌 Example: GET /users – Get all users POST /users – Create a new user PUT… /users/1 – Update…… user with ID 1 DELETE /users/1 – Delete user with ID 1
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: REST (Representational State Transfer) is an architectural style for designing networked applications.
It uses standard HTTP methods to perform CRUD operations on resources, which are typically represented as URLs. ✅ A RESTful API allows different systems (like frontend apps or mobile apps) to interact with your server over HTTP in a stateless manner. 📌 Example: GET /users – Get all users POST /users – Create a new user PUT /users/1 – Update user with ID 1 DELETE /users/1 – Delete user with ID 1
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Strip out dangerous characters. Use libraries like validator.js. Escape output in HTML contexts.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: RESTful APIs use the following standard HTTP methods: Method Purpose GET Retrieve data POST Create new data PUT Update existing PATCH Partial update DELETE Remove data
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Cross-Origin Resource Sharing controls which domains can access your API. Configure with the cors package: const cors = require('cors'); app.use(cors({ origin: ' }));
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Name commonly used ones. HTTP status codes indicate the result of a request: Code Meaning 200 OK 201 Created 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 📌
res.status(201).json({ message: 'User created successfully' });
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' })); pp.use(cors({ origin: ' }));
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: HTTP status codes indicate the result of a request: Code Meaning 200 OK 201 Created 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 📌 res.status(201).json({ message: 'User created successfully' }); HTTP status codes indicate the result of a request: Code Meaning 200 OK 201 Created… 400 Bad Request 401… Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 📌
res.status(201).json({ message: 'User created successfully' }); HTTP status codes indicate the result of a request: Code Meaning 200 OK 201 Created 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 📌 Example: res.status(201).json({ message: 'User created successfully' }); HTTP status codes indicate the result of a request: Code Meaning 200 OK 201 Created… 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 500 Internal Server Error 📌 Example: res.status(201).json({ message: 'User created successfully' });
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Using Express.js, you can quickly set up routes and logic. 📌 Example: const express = require('express'); const app = express(); app.use(express.json()); app.get('/api/users', (req, res) => { res.json([{ id: 1, name: 'Alice' }]); }); app.listen(3000, () => console.log('Server running'));
Using Express.js, you can quickly set up routes and logic. 📌 Example: const express = require('express');
const app = express(); app.use(express.json()); app.get('/api/users', (req, res) => { res.json([{ id: 1, name: 'Alice' }]); }); app.listen(3000, () => console.log('Server running'));
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Validate file types and sizes. Store files outside of the web root. Use libraries like multer. Scan files for malware. REST API & Web Development
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.