Overview of NodeJs:

built on a single-threaded event loop architecture.This means it uses a single thread to handle asynchronous I/O operations, which allows it to handle concurrent connections efficiently.

  1. Main Thread (Event Loop): Node.js runs on a single thread managed by the event loop. This thread handles all I/O operations and asynchronous tasks.
  2. Worker Threads: While the main event loop is single-threaded, Node.js provides a worker_threads module that allows the creation of additional threads for CPU-intensive tasks. These worker threads can execute JavaScript in parallel to the main thread, enabling multi-threaded processing in certain scenarios.
  3. Operating System Threads: Under the hood, Node.js uses native operating system threads for some I/O operations.

When a request is made, Node.js doesn’t wait for it to complete before moving on to the next one. Instead, it continues executing other tasks and processes callbacks when the requested operations finish.

Nodemon -

is a utility for Node.js that monitors changes in your codebase and automatically restarts the Node application when it detects any file modifications.

DEPENDENCIES


  1. Regular Dependencies: These packages are essential for the application to run. For instance, if you’re building a web server using Express.js, Express would be a regular dependency because it’s necessary for your application to work.
npm install <package-name>
  1. Dev Dependencies (Development Dependencies): These packages are used for tasks like testing, building, or local development but are not required for the actual runtime of your application in a production environment. Examples of dev dependencies include

The –save-dev flags adds the packages to package.json file under the DevDEpendencies section. 1. testing frameworks (like Jest) 2. build tools (like Webpack or Gulp) 3. linters (like ESLint), etc.

```jsx
npm install <package-name> --save-dev
```

Common JS modules