Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
Short answer: Node.js runs on a single thread by default, which means it can handle only one operation at a time per process. Clustering allows you to create multiple Node.js processes (workers) that share the same serve…
Short answer: sync function connect() { const uri = 'mongodb://localhost:27017/mydatabase'; const client = new MongoClient(uri); try { wait client.connect(); console.log('Connected to MongoDB'); const db = client.db('myd…
Short answer: time per process. Clustering allows you to create multiple Node.js processes (workers) that share the same server port. This way, your app can utilize multiple CPU cores and handle more requests concurrentl…
Short answer: Node.js is an open-source, cross-platform runtime environment that allows you to run JavaScript on the server side. It’s built on the V8 JavaScript engine developed by Google (the same one used in Chrome).…
Short answer: How do you create and use custom events? EventEmitter allows objects to emit named events and listen for them. Example: const EventEmitter = require('events'); const emitter = new EventEmitter(); emitter.on…
Short answer: EventEmitter allows objects to emit named events and listen for them. Example code const EventEmitter = require('events'); const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(…
Short answer: Process management means keeping your app running reliably, restarting it if it crashes, and managing multiple instances. PM2 is a popular Node.js process manager that: Restarts apps on crashes or code chan…
Short answer: Mongoose is an ODM (Object Data Modeling) library for MongoDB in Node.js. It provides: Schema-based data modeling Validation Middleware (hooks) Easy querying and relationship management You define schemas a…
Short answer: const mongoose = require('mongoose'); const userSchema = new mongoose.Schema({ name: { type: String, required: true }, email: { type: String, required: true, unique: true }, age: Number, createdAt: { type:…
Short answer: Mocha is a test runner that executes your test files, organizes tests in suites (describe), and allows async testing. It does not provide assertions, so it’s often paired with assertion libraries like Chai.…
Short answer: ge: Number, createdAt: { type: Date, default: Date.now } }); const User = mongoose.model('User', userSchema); // Usage example sync function createUser() { const user = new User({ name: 'Alice', email: 'ali…
Short answer: And allows async testing. It does not provide assertions, so it’s often paired with assertion libraries like Chai. Real-world example (ShopNest) A ShopNest BFF in Node.js aggregates catalog and price APIs f…
Short answer: PM2 is a popular production process manager for Node.js applications. It helps you: Manage and keep apps alive forever (auto-restart on crashes). Run apps in cluster mode easily. Monitor resource usage (CPU…
Short answer: The V8 engine is a high-performance JavaScript engine developed by Google for Chrome. Node.js uses it to compile and run JavaScript code on the server side. It converts JS code into machine code, making it…
Short answer: Helmet is a middleware that sets HTTP headers to protect against common attacks: Adds Content Security Policy (CSP) Prevents MIME sniffing Protects against clickjacking Enables HSTS (HTTPS enforcement) Usag…
Short answer: Chai is an assertion library for Node.js that lets you write readable tests with different styles: Expect style (most popular): expect(result).to.equal(5); Should style: result.should.equal(5); Assert style…
Short answer: Load balancing distributes incoming requests across multiple server instances to: Improve performance Increase availability and fault tolerance In Node.js, you can: Use the cluster module to spawn workers o…
Short answer: ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.eq…
Short answer: PUT: Replaces the entire resource with the data sent. If a field is missing in the request, it may get erased. Idempotent (same request repeated yields same result). PATCH: Applies partial updates to the re…
Short answer: Sequelize is a popular ORM for relational databases like MySQL, PostgreSQL, SQLite, and MSSQL. It allows you to: Define models with JavaScript classes Handle migrations and schema changes Write complex quer…
Short answer: Supertest is a library for testing HTTP APIs, especially Express apps. It allows you to simulate HTTP requests and assert on responses. Example: const request = require('supertest'); Example code const app…
Short answer: The event loop is the core of Node.js's non-blocking I/O operations. It handles all asynchronous operations in a single thread, constantly checking for events (e.g., incoming data, timers) and executing ass…
Short answer: Backpressure happens when data is produced faster than it can be consumed downstream. In Node.js streams, it's a built-in mechanism to: Pause the readable stream when the writable stream is overwhelmed. Pre…
Short answer: Service Principal is a security identity for apps or automation. Used for authentication in scripts, CI/CD pipelines, and service-to-service communication. Example – Azure CLI login: az login --service-prin…
Short answer: Azure AD roles – Manage identity and directory-level permissions (e.g., User Administrator, Global Admin) Azure RBAC – Manage resource-level permissions (e.g., Reader, Contributor, Owner) Both work together…
Node.js Node.js Tutorial · Node.js
Short answer: Node.js runs on a single thread by default, which means it can handle only one operation at a time per process. Clustering allows you to create multiple Node.js processes (workers) that share the same server port. This way, your app can utilize multiple CPU cores and handle more requests concurrently. 📌 Example: Using the built-in cluster module, you can fork multiple workers.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: sync function connect() { const uri = 'mongodb://localhost:27017/mydatabase'; const client = new MongoClient(uri); try { wait client.connect(); console.log('Connected to MongoDB'); const db = client.db('mydatabase'); // Use `db` to query collections } catch (err) { console.error(err); } finally { wait client.close(); } } connect(); Example… code sync…… function connect() { const uri =…
'mongodb://localhost:27017/mydatabase'; const client = new MongoClient(uri); try { wait client.connect(); console.log('Connected to MongoDB'); const db = client.db('mydatabase'); // Use `db` to query collections } catch (err) { console.error(err); } finally { wait client.close(); } } connect(); sync function connect() { const uri = 'mongodb://localhost:27017/mydatabase'; const client = new MongoClient(uri); try { wait client.connect(); console.log('Connected to MongoDB'); const db = client.db('mydatabase'); // Use `db` to query collections } catch (err) { console.error(err); } finally { wait client.close(); } } connect(); Example… code sync function…
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: time per process. Clustering allows you to create multiple Node.js processes (workers) that share the same server port. This way, your app can utilize multiple CPU cores and handle more requests concurrently. 📌 Example: Using the built-in cluster module, you can fork multiple workers.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Node.js is an open-source, cross-platform runtime environment that allows you to run JavaScript on the server side. It’s built on the V8 JavaScript engine developed by Google (the same one used in Chrome). With Node.js, you can build scalable and high-performance web applications, APIs, and even real-time services like chat apps. 📌
If you write a simple HTTP server in Node.js, you can serve a webpage without using a traditional web server like Apache: const http = require('http'); http.createServer((req, res) => { res.end('Hello from Node.js server!'); }).listen(3000);
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: How do you create and use custom events? EventEmitter allows objects to emit named events and listen for them. Example: const EventEmitter = require('events'); const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`); }); emitter.emit('greet', 'Alice'); Output: Hello, Alice! It’s fundamental for asynchronous communication in Node.js.
How do you create and use custom events? EventEmitter allows objects to emit named events and listen for them. Example: const EventEmitter = require('events');
const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`); }); emitter.emit('greet', 'Alice'); Output: Hello, Alice! It’s fundamental for asynchronous communication 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: EventEmitter allows objects to emit named events and listen for them.
const EventEmitter = require('events'); const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`); }); emitter.emit('greet', 'Alice'); Output: Hello, Alice! const emitter = new EventEmitter(); emitter.on('greet', (name) => { console.log(`Hello, ${name}!`); }); emitter.emit('greet', 'Alice'); Output: Hello, Alice! It’s fundamental for asynchronous communication 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: Process management means keeping your app running reliably, restarting it if it crashes, and managing multiple instances. PM2 is a popular Node.js process manager that: Restarts apps on crashes or code changes Manages clustering (multi-core usage) Offers logs and monitoring dashboards Supports zero-downtime reloads Run your app with PM2 like this: pm2 start app.js pm2 monit
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Mongoose is an ODM (Object Data Modeling) library for MongoDB in Node.js. It provides: Schema-based data modeling Validation Middleware (hooks) Easy querying and relationship management You define schemas and models to interact with MongoDB more intuitively.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: const mongoose = require('mongoose'); const userSchema = new mongoose.Schema({ name: { type: String, required: true }, email: { type: String, required: true, unique: true }, age: Number, createdAt: { type: Date, default: Date.now } }); const User = mongoose.model('User', userSchema); // Usage example async function createUser() { const user = new User({ name: 'Alice', email: 'alice@example.com', age: 25 }); await…
user.save(); console.log('User saved'); }
const mongoose = require('mongoose'); const userSchema = new mongoose.Schema({ name: { type: String, required: true }, email: { type: String, required: true, unique: true }, age: Number, createdAt: { type: Date, default: Date.now } }); const User = mongoose.model('User', userSchema); // Usage example async function createUser() { const user = new User({ name: 'Alice', email: 'alice@example.com', age: 25 }); await user.save(); console.log('User saved'); }
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Mocha is a test runner that executes your test files, organizes tests in suites (describe), and allows async testing. It does not provide assertions, so it’s often paired with assertion libraries like Chai.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: ge: Number, createdAt: { type: Date, default: Date.now } }); const User = mongoose.model('User', userSchema); // Usage example sync function createUser() { const user = new User({ name: 'Alice', email: 'alice@example.com', ge: 25 }); wait user.save(); console.log('User saved'); } ge: Number, createdAt: { type: Date, default:… Date.now } }); const User =…… mongoose.model('User', userSchema); // Usage example sync…
function createUser() { const user = new User({ name: 'Alice', email: 'alice@example.com', ge: 25 }); wait user.save(); console.log('User saved'); } ge: Number, createdAt: { type: Date, default: Date.now } }); const User = mongoose.model('User', userSchema); // Usage example sync function createUser() { const user = new User({ name: 'Alice', email: 'alice@example.com', ge: 25 }); wait user.save(); console.log('User saved'); } ge: Number, createdAt: { type: Date, default:… Date.now } }); const User = mongoose.model('User', userSchema); // Usage example sync function createUser() { const user = new User({ name: 'Alice', email:…
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: And allows async testing. It does not provide assertions, so it’s often paired with assertion libraries like Chai.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: PM2 is a popular production process manager for Node.js applications. It helps you: Manage and keep apps alive forever (auto-restart on crashes). Run apps in cluster mode easily. Monitor resource usage (CPU, memory). Handle zero-downtime reloads. npm install pm2 -g pm2 start app.js -i max # Runs in cluster mode with max CPU cores
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 V8 engine is a high-performance JavaScript engine developed by Google for Chrome. Node.js uses it to compile and run JavaScript code on the server side. It converts JS code into machine code, making it fast and efficient. 📌 Use Case: When you run a .js file with Node.js, the V8 engine compiles your code into machine code behind the scenes.
Node.js Node.js Tutorial · Node.js
Short answer: Helmet is a middleware that sets HTTP headers to protect against common attacks: Adds Content Security Policy (CSP) Prevents MIME sniffing Protects against clickjacking Enables HSTS (HTTPS enforcement) Usage: const helmet = require('helmet'); app.use(helmet());
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Chai is an assertion library for Node.js that lets you write readable tests with different styles: Expect style (most popular): expect(result).to.equal(5); Should style: result.should.equal(5); Assert style: assert.equal(result, 5);
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Load balancing distributes incoming requests across multiple server instances to: Improve performance Increase availability and fault tolerance In Node.js, you can: Use the cluster module to spawn workers on multiple CPU cores. Use external load balancers like Nginx, HAProxy, or cloud load balancers. PM2 also supports clustering with: pm2 start app.js -i max
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5); ssert style: ssert.equal(result, 5);
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: PUT: Replaces the entire resource with the data sent. If a field is missing in the request, it may get erased. Idempotent (same request repeated yields same result). PATCH: Applies partial updates to the resource. Only changes the fields specified. Not necessarily idempotent.
Updating user email. PUT /users/1 with { "name": "Alice" } replaces whole user — email might get removed. PATCH /users/1 with { "email": "new@example.com" } updates just the email.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Sequelize is a popular ORM for relational databases like MySQL, PostgreSQL, SQLite, and MSSQL. It allows you to: Define models with JavaScript classes Handle migrations and schema changes Write complex queries using JavaScript instead of raw SQL
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Node.js Node.js Tutorial · Node.js
Short answer: Supertest is a library for testing HTTP APIs, especially Express apps. It allows you to simulate HTTP requests and assert on responses. Example: const request = require('supertest');
const app = require('../app'); // Your Express app describe('GET /users', () => { it('should return 200 and a list of users', (done) => { request(app) .get('/users') .expect(200) .expect('Content-Type', /json/) .end((err, res) => { if (err) return done(err); done(); }); }); });
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 event loop is the core of Node.js's non-blocking I/O operations. It handles all asynchronous operations in a single thread, constantly checking for events (e.g., incoming data, timers) and executing associated callbacks. 📌
setTimeout(() => { console.log('Executed after 2 seconds'); }, 2000); This callback is scheduled by the event loop and executed when the time is up.
Node.js Node.js Tutorial · Node.js
Short answer: Backpressure happens when data is produced faster than it can be consumed downstream. In Node.js streams, it's a built-in mechanism to: Pause the readable stream when the writable stream is overwhelmed. Prevent memory overload and crashes. This flow control allows producers and consumers to work in sync.
A ShopNest BFF in Node.js aggregates catalog and price APIs for the React storefront.
Microsoft Azure Microsoft Azure Tutorial · Azure
Short answer: Service Principal is a security identity for apps or automation. Used for authentication in scripts, CI/CD pipelines, and service-to-service communication. Example – Azure CLI login: az login --service-principal -u <appId> -p <password> --tenant <tenantId>
ShopNest on Azure typically uses App Service + SQL Database + Blob Storage + Application Insights for monitoring.
Microsoft Azure Microsoft Azure Tutorial · Azure
Short answer: Azure AD roles – Manage identity and directory-level permissions (e.g., User Administrator, Global Admin) Azure RBAC – Manage resource-level permissions (e.g., Reader, Contributor, Owner) Both work together to enforce security and access control in Azure.