Node Study Questions
What is Node.js?
- Node.js is an asynchronous, event-driven JavaScript Runtime environment.
Explain callback in Node.js.
- A callback function is called after a given task. It allows other code to be run in the meantime and prevents any blocking. Being an asynchronous platform, Node.js heavily relies on callback. All APIs of Node are written to support callbacks.
How is Node.js most frequently used?
- Node.js is widely used for real-time chats, internet of things, complex single-page applications, real-time collaboration tools, streaming applications, and microservices architecture.
What are the modules in Node.js?
- Modules are like JavaScript libraries that can be used in a Node.js application to include a set of functions. To include a module in a Node.js application, use the require() function with the parentheses containing the module's name.
What is the command that is used in node.js execute/run a file?
- Use the node cli to run a file
- Example:
What is Express.js?
- Express.js is a popular server framework built on Node.js for creating HTTP and HTTPS servers with routing and middleware.