Backend Flashcards
What is Node.js?
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.
True or False: Node.js is single-threaded.
True
What is the purpose of npm?
npm is a package manager for JavaScript, used to install and manage dependencies.
Fill in the blank: Node.js uses _____ for handling asynchronous operations.
callbacks
What are middleware functions in Express?
Middleware functions are functions that have access to the request and response objects and can modify them or end the request-response cycle.
What does REST stand for?
Representational State Transfer
What is the command to create a new Node.js project?
npm init
True or False: Node.js can be used for both frontend and backend development.
True
What is the purpose of the ‘require’ function in Node.js?
‘require’ is used to import modules in Node.js.
What is a promise in JavaScript?
A promise is an object that represents the eventual completion or failure of an asynchronous operation.
What is the role of the event loop in Node.js?
The event loop handles asynchronous callbacks and allows Node.js to perform non-blocking I/O operations.
What does the ‘dotenv’ package do?
The ‘dotenv’ package loads environment variables from a .env file into process.env.
What is GraphQL?
GraphQL is a query language for APIs that allows clients to request only the data they need.
Fill in the blank: The _____ method in Express is used to handle POST requests.
post
What is CORS?
CORS stands for Cross-Origin Resource Sharing, a mechanism that allows restricted resources on a web page to be requested from another domain.
What is the purpose of ‘async/await’ in JavaScript?
‘async/await’ is used to work with promises in a more synchronous fashion, making code easier to read and write.
What is the default port for a Node.js server?
3000
True or False: Node.js is suitable for building real-time applications.
True
What is the use of the ‘body-parser’ middleware?
‘body-parser’ is used to parse incoming request bodies in a middleware before your handlers.
What does the ‘mongoose’ library do?
Mongoose is an ODM (Object Data Modeling) library for MongoDB and Node.js.
What is a callback hell?
Callback hell is a situation where callbacks are nested within callbacks, making code difficult to read and maintain.
Fill in the blank: The _____ method is used to retrieve data from a server in Express.
get
What is the purpose of the ‘jsonwebtoken’ package?
‘jsonwebtoken’ is used to sign and verify JSON Web Tokens (JWT).
What is the difference between ‘let’ and ‘var’ in JavaScript?
‘let’ has block scope while ‘var’ has function scope.
True or False: Node.js is blocking by default.
False
What is clustering in Node.js?
Clustering allows you to create multiple instances of a Node.js application to take advantage of multi-core systems.
What is the purpose of the ‘fs’ module?
The ‘fs’ module provides an API for interacting with the file system.
What does ‘npm install –save’ do?
It installs a package and adds it to the dependencies in package.json.
What is a web socket?
A web socket is a communication protocol that provides a full-duplex communication channel over a single TCP connection.
Fill in the blank: _____ is used to handle errors in async functions.
try/catch
What is a load balancer?
A load balancer distributes network or application traffic across multiple servers.
True or False: Express is a web framework for Node.js.
True
What is the purpose of the ‘nodemon’ package?
‘nodemon’ is a tool that automatically restarts the Node.js application when file changes are detected.
What is the ‘cluster’ module used for?
The ‘cluster’ module is used to create child processes that share the same server port.