├── 02 Intro to Node-2 ├── Codes │ ├── fs demo │ │ ├── deleting content of a file │ │ │ ├── arvind.txt │ │ │ └── delete.js │ │ ├── reading a file │ │ │ ├── arvind.txt │ │ │ └── reading.js │ │ └── writing a file │ │ │ ├── arvind.txt │ │ │ └── writing.js │ ├── default export │ │ ├── package.json │ │ ├── index.js │ │ └── alzebra.js │ ├── named export │ │ ├── package.json │ │ ├── index.js │ │ └── alzebra.js │ └── process_demo.js └── node2.md ├── 01 Intro to Node-1 ├── Codes │ ├── ES module demo │ │ ├── using package.json file │ │ │ ├── package.json │ │ │ ├── index.js │ │ │ └── alzebra.js │ │ └── using .mjs file │ │ │ ├── index.mjs │ │ │ └── alzebra.js │ ├── global_obj.js │ └── CommonJS modules demo │ │ ├── index.js │ │ └── alzebra.js └── node1.md ├── 05 Setting up the http server ├── using express framework │ ├── package.json │ ├── server.js │ ├── .gitignore │ └── package-lock.json └── using http module │ └── server.js ├── README.md ├── 04 Client Server Achitecture └── client_server.md └── 06 MVC Architecture └── mvc.md /02 Intro to Node-2/Codes/fs demo/deleting content of a file/arvind.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/fs demo/reading a file/arvind.txt: -------------------------------------------------------------------------------- 1 | Hello! I'm arvind🌻 -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/default export/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/named export/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/fs demo/writing a file/arvind.txt: -------------------------------------------------------------------------------- 1 | Hello! I'm arvind🌻I'm 21y old ⚡ -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/ES module demo/using package.json file/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/process_demo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * console.log("hello, arvind!") 3 | */ 4 | 5 | process.stdout.write("hello, arvind!"); 6 | process.stdout.write(" nice to meet ya"); 7 | -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/global_obj.js: -------------------------------------------------------------------------------- 1 | /** 2 | * console.log(document); 3 | * it won't work outside the browser 4 | */ 5 | 6 | //console.log(process); 7 | console.log(__dirname); 8 | console.log(__filename); 9 | console.log(module); 10 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/fs demo/deleting content of a file/delete.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | fs.unlink(__dirname + "/arvind.txt", (err) => { 4 | if (err) { 5 | console.error("Error deleting file:", err); 6 | return; 7 | } 8 | 9 | console.log("File deleted successfully."); 10 | }); 11 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/fs demo/reading a file/reading.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | fs.readFile(__dirname + "/arvind.txt", "utf8", (err, data) => { 4 | if (err) { 5 | console.error("Error reading file:", err); 6 | return; 7 | } 8 | 9 | console.log("File contents:", data); 10 | }); 11 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/named export/index.js: -------------------------------------------------------------------------------- 1 | import { addition, subtraction, multiplication, division } from "./alzebra.js"; 2 | 3 | let num1 = 10; 4 | let num2 = 5; 5 | 6 | //addition 7 | let calculateAddition = addition(num1, num2); 8 | console.log(calculateAddition); 9 | 10 | //division 11 | console.log(division(num1, num2)); 12 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/default export/index.js: -------------------------------------------------------------------------------- 1 | import doCalculation from "./alzebra.js"; 2 | 3 | let num1 = 10; 4 | let num2 = 5; 5 | 6 | console.log(doCalculation); 7 | //addition 8 | let addition = doCalculation.addition(num1, num2); 9 | console.log(addition); 10 | 11 | //division 12 | console.log(doCalculation.division(num1, num2)); 13 | -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/CommonJS modules demo/index.js: -------------------------------------------------------------------------------- 1 | const doCalculation = require("./alzebra"); 2 | 3 | let num1 = 10; 4 | let num2 = 5; 5 | 6 | console.log(doCalculation); 7 | //addition 8 | let addition = doCalculation.addition(num1, num2); 9 | console.log(addition); 10 | 11 | //division 12 | console.log(doCalculation.division(num1, num2)); 13 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/named export/alzebra.js: -------------------------------------------------------------------------------- 1 | export function addition(num1, num2) { 2 | return num1 + num2; 3 | } 4 | export function subtraction(num1, num2) { 5 | return num1 - num2; 6 | } 7 | export function multiplication(num1, num2) { 8 | return num1 * num2; 9 | } 10 | export function division(num1, num2) { 11 | return num1 / num2; 12 | } 13 | -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/ES module demo/using package.json file/index.js: -------------------------------------------------------------------------------- 1 | import doCalculation from "./alzebra.js"; 2 | 3 | let num1 = 10; 4 | let num2 = 5; 5 | 6 | console.log(doCalculation); 7 | //addition 8 | let addition = doCalculation.addition(num1, num2); 9 | console.log(addition); 10 | 11 | //division 12 | console.log(doCalculation.division(num1, num2)); 13 | -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/ES module demo/using .mjs file/index.mjs: -------------------------------------------------------------------------------- 1 | //const doCalculation = require("./alzebra"); 2 | import doCalculation from "./alzebra.js"; 3 | 4 | let num1 = 10; 5 | let num2 = 5; 6 | 7 | console.log(doCalculation); 8 | //addition 9 | let addition = doCalculation.addition(num1, num2); 10 | console.log(addition); 11 | 12 | //division 13 | console.log(doCalculation.division(num1, num2)); 14 | -------------------------------------------------------------------------------- /05 Setting up the http server/using express framework/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "using-express-framework", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.18.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /05 Setting up the http server/using express framework/server.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const app = express(); 3 | const PORT = 3000; 4 | 5 | app.get("/", (req, res) => res.send("welcome to home, arvind:)")); 6 | app.post("/arvind", (req, res) => { 7 | res.json({ 8 | name: "arvind", 9 | age: 21, 10 | }); 11 | }); 12 | 13 | app.listen(PORT, () => console.log("App is running on PORT " + PORT)); 14 | -------------------------------------------------------------------------------- /05 Setting up the http server/using express framework/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/fs demo/writing a file/writing.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | 3 | const data = `I'm 21y old ⚡`; 4 | 5 | // fs.writeFile(__dirname + "/arvind.txt", data, "utf8", (err) => { 6 | // if (err) { 7 | // console.error("Error writing to file:", err); 8 | // return; 9 | // } 10 | 11 | // console.log("File write operation completed."); 12 | // }); 13 | 14 | fs.appendFile(__dirname + "/arvind.txt", data, "utf8", () => { 15 | console.log("text appended succesfully"); 16 | }); 17 | -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/CommonJS modules demo/alzebra.js: -------------------------------------------------------------------------------- 1 | function addition(num1, num2) { 2 | return num1 + num2; 3 | } 4 | function subtraction(num1, num2) { 5 | return num1 - num2; 6 | } 7 | function multiplication(num1, num2) { 8 | return num1 * num2; 9 | } 10 | function division(num1, num2) { 11 | return num1 / num2; 12 | } 13 | 14 | //exporting by common js modules 15 | module.exports = { 16 | addition: addition, 17 | subtraction: subtraction, 18 | multiplication: multiplication, 19 | division: division, 20 | }; 21 | -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/ES module demo/using .mjs file/alzebra.js: -------------------------------------------------------------------------------- 1 | function addition(num1, num2) { 2 | return num1 + num2; 3 | } 4 | function subtraction(num1, num2) { 5 | return num1 - num2; 6 | } 7 | function multiplication(num1, num2) { 8 | return num1 * num2; 9 | } 10 | function division(num1, num2) { 11 | return num1 / num2; 12 | } 13 | 14 | //exporting by ES modules 15 | module.exports = { 16 | addition: addition, 17 | subtraction: subtraction, 18 | multiplication: multiplication, 19 | division: division, 20 | }; 21 | -------------------------------------------------------------------------------- /02 Intro to Node-2/Codes/default export/alzebra.js: -------------------------------------------------------------------------------- 1 | function addition(num1, num2) { 2 | return num1 + num2; 3 | } 4 | function subtraction(num1, num2) { 5 | return num1 - num2; 6 | } 7 | function multiplication(num1, num2) { 8 | return num1 * num2; 9 | } 10 | function division(num1, num2) { 11 | return num1 / num2; 12 | } 13 | 14 | const doCalcution = { 15 | addition: addition, 16 | subtraction: subtraction, 17 | multiplication: multiplication, 18 | division: division, 19 | }; 20 | export default doCalcution; 21 | 22 | // export default { 23 | // addition: addition, 24 | // subtraction: subtraction, 25 | // multiplication: multiplication, 26 | // division: division, 27 | // }; 28 | -------------------------------------------------------------------------------- /01 Intro to Node-1/Codes/ES module demo/using package.json file/alzebra.js: -------------------------------------------------------------------------------- 1 | function addition(num1, num2) { 2 | return num1 + num2; 3 | } 4 | function subtraction(num1, num2) { 5 | return num1 - num2; 6 | } 7 | function multiplication(num1, num2) { 8 | return num1 * num2; 9 | } 10 | function division(num1, num2) { 11 | return num1 / num2; 12 | } 13 | 14 | // //exporting by common js modules 15 | // module.exports = { 16 | // addition: addition, 17 | // subtraction: subtraction, 18 | // multiplication: multiplication, 19 | // division: division, 20 | // }; 21 | 22 | const doCalcution = { 23 | addition: addition, 24 | subtraction: subtraction, 25 | multiplication: multiplication, 26 | division: division, 27 | }; 28 | export default doCalcution; 29 | -------------------------------------------------------------------------------- /05 Setting up the http server/using http module/server.js: -------------------------------------------------------------------------------- 1 | const http = require("http"); 2 | const PORT = 3000; 3 | /** 4 | * Http module contains a function called as createServer 5 | * this createServer function takes a callback as the input 6 | * Now inside the callback, we get two arguments 7 | * - request -> this argument contains all the details about the incoming req 8 | * - response -> this argument contains functions using which we can prepare the responses 9 | * 10 | * the createServer function returns us the server object 11 | */ 12 | 13 | const server = http.createServer((req, res) => { 14 | console.log(req.method); 15 | if (req.url == "/home") res.end("Welcome to the Home Page, ARVIND"); 16 | else if (req.url == "/shopping") res.end("Let's Do Some Shopping"); 17 | else res.end("This is Arvind Server"); 18 | }); 19 | 20 | server.listen(PORT, () => { 21 | // once the server starts running on the port 22 | // then the this callback will get executed 23 | console.log("server is listening at port " + PORT); 24 | }); 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Node.js Learning Repository 2 | 3 | 🌟 Welcome to my Node.js learning repository! 🌟 4 | 5 | My name is Arvind Pandit, a frontend developer exploring the backend world and striving to learn as much as I can. 🚀 Currently, I'm learning Node.js and documenting my code and notes in this repository so that others can easily access and learn from it. 📚 6 | 7 | ## Contents 📜 8 | 9 | This repository is structured into different parts, each focusing on different aspects of Node.js. Here's a sneak peek into what you can expect from each part: 10 | 11 | 1. 🌱 [Introduction to Node - Part 1](https://github.com/arvindpndit/nodeJS/blob/master/01%20Intro%20to%20Node-1/node1.md) 12 | 2. 🌱 [Introduction to Node - Part 2](https://github.com/arvindpndit/nodeJS/blob/master/02%20Intro%20to%20Node-2/node2.md) 13 | 3. 💡 [Project 0 : CLI Notes](https://github.com/arvindpndit/CLI-Notes) 14 | 4. 🧠 Node.js - Part 3 15 | 5. 💡 [Project 1 : defineBOT ( Telegram Bot)](https://github.com/arvindpndit/defineBOT) 16 | 6. 🌐 [Client-Server Architecture](https://github.com/arvindpndit/nodeJS/blob/master/04%20Client%20Server%20Achitecture/client_server.md) 17 | 7. ⚙️ Setting up an HTTP Server 18 | 8. 🎡 [MVC Architecture](https://github.com/arvindpndit/nodeJS/blob/master/06%20MVC%20Architecture/mvc.md) 19 | 20 | ## 📚 Prerequisites 21 | 22 | Before diving into this repository, it's recommended to have a basic understanding of JavaScript and web development concepts. Familiarity with HTML, CSS, and basic programming principles will greatly enhance your learning experience with Node.js. 23 | 24 | ## 📞 Contact Me 25 | 26 | If you have any questions, suggestions, or feedback, feel free to reach out to me. You can contact me through the following channels: 27 | 28 | - LinkedIn: [ARVIND PANDIT](https://www.linkedin.com/in/arvindpndit/) 29 | 30 | I'm open to discussions, collaborations, and any help you may need on your learning journey. 31 | 32 | ## 🤝 Contributing 33 | 34 | Contributions are welcome! If you have any improvements, suggestions, or additional resources related to the topics covered in this repository, please feel free to contribute. Fork this repository, make your changes, and submit a pull request. Together, we can make this learning resource even more valuable. 35 | 36 | Happy learning! 🎉 37 | -------------------------------------------------------------------------------- /02 Intro to Node-2/node2.md: -------------------------------------------------------------------------------- 1 | # Introduction to Node.js - Part 2 2 | 3 | Welcome to the second part of the Introduction to Node.js series! In this part, we will explore named and default exports of modules, the use of the `process` global object, and the `fs` module for file system operations. 4 | 5 | ## Named Export 6 | 7 | Named export allows us to export multiple functions or variables from a module using their specific names. This allows us to selectively import and use those exports in other modules. 8 | 9 | **Code Example:** 10 | 11 | ```javascript 12 | // alzebra.js 13 | export function addition(num1, num2) { 14 | return num1 + num2; 15 | } 16 | export function subtraction(num1, num2) { 17 | return num1 - num2; 18 | } 19 | export function multiplication(num1, num2) { 20 | return num1 * num2; 21 | } 22 | export function division(num1, num2) { 23 | return num1 / num2; 24 | } 25 | 26 | // index.js 27 | import { addition, subtraction, multiplication, division } from "./alzebra.js"; 28 | 29 | let num1 = 10; 30 | let num2 = 5; 31 | 32 | // Addition 33 | let calculateAddition = addition(num1, num2); 34 | console.log(calculateAddition); 35 | 36 | // Division 37 | console.log(division(num1, num2)); 38 | ``` 39 | 40 | ## Default Export 41 | 42 | Default export allows us to export a single function, object, or value from a module. When importing a default export, we can assign it any name we like. 43 | 44 | **Code Example:** 45 | 46 | ```javascript 47 | // alzebra.js 48 | function addition(num1, num2) { 49 | return num1 + num2; 50 | } 51 | function subtraction(num1, num2) { 52 | return num1 - num2; 53 | } 54 | function multiplication(num1, num2) { 55 | return num1 * num2; 56 | } 57 | function division(num1, num2) { 58 | return num1 / num2; 59 | } 60 | 61 | const doCalculation = { 62 | addition: addition, 63 | subtraction: subtraction, 64 | multiplication: multiplication, 65 | division: division, 66 | }; 67 | export default doCalculation; 68 | 69 | // index.js 70 | import doCalculation from "./alzebra.js"; 71 | 72 | let num1 = 10; 73 | let num2 = 5; 74 | 75 | console.log(doCalculation); 76 | // Addition 77 | let additionResult = doCalculation.addition(num1, num2); 78 | console.log(additionResult); 79 | 80 | // Division 81 | console.log(doCalculation.division(num1, num2)); 82 | ``` 83 | 84 | ## `process` Global Object 85 | 86 | The `process` global object in Node.js provides information and control over the current Node.js process. It can be used to print output to the terminal, similar to `console.log()`. 87 | 88 | **Code Example:** 89 | 90 | ```javascript 91 | process.stdout.write("hello, arvind!"); 92 | process.stdout.write(" nice to meet ya"); 93 | ``` 94 | 95 | ## `fs` Module in Node.js 96 | 97 | The `fs` module in Node.js provides an API for interacting with the file system. It enables performing various CRUD (Create, Read, Update, Delete) operations on files. 98 | 99 | Let's take a look at an example of creating, reading, and deleting a file using the `fs` module. 100 | 101 | **Creating a File:** 102 | 103 | ```javascript 104 | const fs = require("fs"); 105 | 106 | const data = `I'm 21y old ⚡`; 107 | 108 | // fs.writeFile(__dirname + "/arvind.txt", data, "utf8", (err) => { 109 | // if (err) { 110 | // console.error("Error writing to file:", err); 111 | // return; 112 | // } 113 | 114 | // console.log("File write operation completed."); 115 | // }); 116 | 117 | fs.appendFile(__dirname + "/arvind.txt", data, "utf8", () => { 118 | console.log("Text appended successfully."); 119 | }); 120 | ``` 121 | 122 | **Reading a File:** 123 | 124 | ```javascript 125 | const fs = require("fs"); 126 | 127 | fs.readFile(__dirname + "/arvind.txt", "utf8", (err, data) => { 128 | if (err) { 129 | console.error("Error reading file:", err); 130 | return; 131 | } 132 | 133 | console.log("File contents:", data); 134 | }); 135 | ``` 136 | 137 | **Deleting a File:** 138 | 139 | ```javascript 140 | const fs = require("fs"); 141 | 142 | fs.unlink(__dirname + "/arvind.txt", (err) => { 143 | if (err) { 144 | console.error("Error deleting file:", err); 145 | return; 146 | } 147 | 148 | console.log("File deleted successfully."); 149 | }); 150 | ``` 151 | 152 | ## Conclusion 153 | 154 | In this part, we learned about named and default exports in Node.js modules. We explored how to use named exports to selectively import functions or variables from a module, as well as how to export a default value from a module and import it using any name we like. 155 | 156 | Additionally, we discovered the `process` global object, which allows us to write to the terminal in Node.js. We also explored the `fs` module, which provides file system operations such as creating, reading, and deleting files. 157 | 158 | These concepts and modules are essential in building robust Node.js applications and manipulating files in the file system. Keep exploring and experimenting to gain a deeper understanding of Node.js and its vast ecosystem! 159 | -------------------------------------------------------------------------------- /04 Client Server Achitecture/client_server.md: -------------------------------------------------------------------------------- 1 | # Client-Server Architecture 2 | 3 | In client-server architecture, there are two main components: the client and the server. 4 | 5 | ### Client 6 | 7 | The client refers to the user-facing interactive end, commonly known as the frontend. It is the part of the system that users directly interact with. 8 | 9 | ### Server 10 | 11 | The server is a hardware or computer that provides services to other computer programs or different machines. It is responsible for processing requests from clients and returning the requested data or performing the requested actions. 12 | 13 | ### Connecting the Client with the Server 14 | 15 | The connection between the client and the server is established through an API (Application Programming Interface). 16 | 17 | ### API 18 | 19 | API stands for Application Programming Interface. In simple terms, it is a contract between the frontend/client and the backend/server. 20 | 21 | ### API Contract 22 | 23 | The API contract specifies: 24 | 25 | - The URL to hit 26 | - The type of request to be made 27 | - The data to be sent 28 | - And other relevant details 29 | 30 | There are various conventions for writing APIs, including: 31 | 32 | - REST (Representational State Transfer) 33 | - SOAP (Simple Object Access Protocol) 34 | - gRPC (Google Remote Procedure Call) 35 | 36 | Let's focus on REST APIs. 37 | 38 | ### REST APIs 39 | 40 | REST APIs (Representational State Transfer) consider every real-life entity as a resource. When making requests to a RESTful API, the request type must be specified. 41 | 42 | The request types in REST APIs are as follows: 43 | 44 | - GET: Retrieve information about a resource. 45 | - DELETE: Delete a resource. 46 | - PATCH: Make a partial update to a resource. 47 | - PUT: Make a complete update to a resource. 48 | - POST: Create a side effect on a resource. 49 | 50 | ## Difference between GET and POST requests: 51 | 52 | - GET: Data is sent in the URL, which means it gets saved in the browser history and can be logged. 53 | - POST: General data is not expected to be sent in the URL but rather in the request body/payload. It is more secure than a GET request. 54 | 55 | ### Three ways of sending data in a REST API: 56 | 57 | 1. Request Parameters: Parameters sent as part of the request URL. 58 | 2. Query Parameters: Parameters appended to the URL after a question mark, typically used for filtering or sorting. 59 | 3. Request Body: Data sent as part of the request payload/body, often in JSON format. 60 | 61 | Note: 62 | 63 | - In the REST convention, data/messages apart from the URL are sent in JSON format. 64 | - HTML only supports GET and POST requests. 65 | 66 | ### Examples of sending data in REST APIs: 67 | 68 | 1. Request Parameters: 69 | 70 | URL: `https://api.example.com/users?id=123` 71 | 72 | In this example, the data is sent as a request parameter (`id`) in the URL. The server can retrieve the value of the `id` parameter to identify and process the request accordingly. 73 | 74 | 2. Query Parameters: 75 | 76 | URL: `https://api.example.com/products?category=electronics&price_range=100-500` 77 | 78 | Here, the data is sent as query parameters (`category` and `price_range`) appended to the URL. The server can extract these parameters to filter the products based on the specified category and price range. 79 | 80 | 3. Request Body: 81 | 82 | URL: `https://api.example.com/users` 83 | 84 | Request Body (JSON): 85 | 86 | ``` 87 | { 88 | "name": "John Doe", 89 | "email": "johndoe@example.com", 90 | "age": 30 91 | } 92 | ``` 93 | 94 | In this case, the data is sent in the request body. The server expects the data to be in JSON format. The example shows a user creation request, where the client provides the user's name, email, and age as a JSON object in the request body. 95 | 96 | These examples demonstrate different ways of sending data in REST APIs. The appropriate method to use depends on the specific requirements and the type of data being transmitted. 97 | 98 | ## Difference between Monolithic and Microservice Architecture: 99 | 100 | Monolithic Architecture: 101 | 102 | - The entire application is built as a single, self-contained unit. 103 | - All components are tightly coupled, making it difficult to scale or modify individual parts. 104 | - A single failure can bring down the entire system. 105 | 106 | Microservice Architecture: 107 | 108 | - The application is broken down into smaller, independent services that communicate with each other. 109 | - Each service can be developed, deployed, and scaled independently. 110 | - Failures are isolated to individual services, reducing the impact on the overall system. 111 | 112 | ## Conclusion: 113 | 114 | In client-server architecture, the client and server are the main components. They connect through APIs, which serve as a contract between the frontend/client and the backend/server. REST APIs are a popular choice, treating real-life entities as resources and utilizing different request types. Monolithic architecture involves building a single unit, while microservice architecture breaks the application into independent services. 115 | -------------------------------------------------------------------------------- /01 Intro to Node-1/node1.md: -------------------------------------------------------------------------------- 1 | # Introduction to Node.js 2 | 3 | Node.js is a runtime environment for JavaScript that was created by Ryan Dahl in 2009. It is not a framework but rather a platform that allows developers to execute JavaScript code on the server-side. In this readme file, we will explore various aspects of Node.js, including its runtime environment, globals, and module patterns. 4 | 5 | ## Runtime Environment 6 | 7 | A runtime environment is a software framework that provides the necessary components and libraries for executing programs written in a specific programming language. In the case of Node.js, it serves as a runtime environment for JavaScript, allowing developers to run JavaScript code outside of a web browser. 8 | 9 | ## Difference between Library and Framework 10 | 11 | A library is a collection of pre-written code that provides specific functionalities that can be used by applications. It is a set of tools that developers can call upon when needed. On the other hand, a framework is a broader concept that defines the overall structure and architecture of an application. It provides a foundation for building applications and often dictates how the application should be designed and organized. 12 | 13 | ## Globals in Node.js 14 | 15 | Node.js provides several global objects and variables that are accessible throughout the application. Some commonly used globals in Node.js include: 16 | 17 | - `__dirname`: A string representing the directory name of the current module. 18 | - `__filename`: A string representing the file name of the current module. 19 | - `exports`: An object used to export variables, functions, or objects from a module. 20 | - `module`: An object representing the current module. 21 | - `require()`: A function used to import modules or files. 22 | - `process`: An object representing the current Node.js process. 23 | - `console`: The console object provides methods to log and display information in the console. 24 | - `setTimeout & setInterval`: These functions are used to schedule the execution of code after a certain delay (setTimeout) or at fixed intervals (setInterval). 25 | 26 | For example, you can use `console.log(__dirname)` to print the current directory name or `console.log(process)` to access information about the current process. 27 | 28 | ## Module Pattern in Node.js 29 | 30 | In Node.js, modules are used to organize and encapsulate code into separate files, making it easier to manage and reuse code. There are two common ways of preparing modules in Node.js: CommonJS modules and ES modules. 31 | 32 | ### CommonJS Module 33 | 34 | CommonJS is the module system used by Node.js by default. It uses the `module.exports` object to define what can be accessed from a module. Here's an example: 35 | 36 | ```javascript 37 | // File: alzebra.js 38 | function addition(num1, num2) { 39 | return num1 + num2; 40 | } 41 | 42 | // Exporting functions using CommonJS 43 | module.exports = { 44 | addition: addition, 45 | }; 46 | 47 | // File: index.js 48 | const doCalculation = require("./alzebra"); 49 | 50 | let num1 = 5; 51 | let num2 = 10; 52 | let result = doCalculation.addition(num1, num2); 53 | console.log(result); // Output: 15 54 | ``` 55 | 56 | In the above example, we define the `addition` function in the `alzebra.js` module and export it using `module.exports`. Then, in the `index.js` module, we import the `doCalculation` object from `alzebra.js` using `require` and use the exported function. 57 | 58 | ### ES Module 59 | 60 | ES modules are a standard for organizing and sharing JavaScript code. Node.js added support for ES modules starting from version 13. To use ES modules in Node.js, you can either use the `.mjs` file extension or specify `"type": "module"` in the `package.json` file. Here's an example: 61 | 62 | #### Using .mjs File 63 | 64 | ````javascript 65 | // File: alzebra.js 66 | function addition(num1, num2) { 67 | return num1 + num2; 68 | } 69 | 70 | // Exporting functions using ES modules 71 | export default { 72 | addition: addition 73 | }; 74 | `` 75 | 76 | ` 77 | 78 | ```javascript 79 | // File: index.mjs 80 | import doCalculation from "./alzebra.js"; 81 | 82 | let num1 = 5; 83 | let num2 = 10; 84 | let result = doCalculation.addition(num1, num2); 85 | console.log(result); // Output: 15 86 | ```` 87 | 88 | #### Using package.json File 89 | 90 | To use ES modules with the `package.json` file, add the following configuration: 91 | 92 | ```json 93 | { 94 | "type": "module" 95 | } 96 | ``` 97 | 98 | ```javascript 99 | // File: alzebra.js 100 | function addition(num1, num2) { 101 | return num1 + num2; 102 | } 103 | 104 | // Exporting functions using ES modules 105 | const doCalculation = { 106 | addition: addition, 107 | }; 108 | export default doCalculation; 109 | ``` 110 | 111 | ```javascript 112 | // File: index.js 113 | import doCalculation from "./alzebra.js"; 114 | 115 | let num1 = 5; 116 | let num2 = 10; 117 | let result = doCalculation.addition(num1, num2); 118 | console.log(result); // Output: 15 119 | ``` 120 | 121 | ## Conclusion 122 | 123 | Node.js is a powerful runtime environment for executing JavaScript on the server-side. It allows developers to build scalable and efficient applications using JavaScript. In this readme file, we covered the basics of Node.js, including its runtime environment, globals, and module patterns. Understanding these concepts will provide a solid foundation for developing Node.js applications. 124 | -------------------------------------------------------------------------------- /06 MVC Architecture/mvc.md: -------------------------------------------------------------------------------- 1 | # Understanding MVC Architecture in Node.js Projects 2 | 3 | In the world of web development, designing and organizing the codebase is crucial for creating scalable and maintainable applications. One popular architectural pattern that helps achieve this goal is the Model-View-Controller (MVC) architecture. In this post, we'll explore the MVC architecture in the context of a Node.js project. 4 | 5 | ## What is MVC Architecture? 6 | 7 | MVC is an architectural pattern that separates an application into three interconnected components: the Model, the View, and the Controller. Each component has its own responsibilities, making the codebase more modular and easier to manage. 8 | 9 | **1. Model:** The Model represents the data and business logic of the application. It defines how the data is structured, stored, and manipulated. In Node.js, models typically interact with databases or other data sources to retrieve and store data. 10 | 11 | **2. View:** The View is responsible for presenting the data to the users. It deals with the user interface, rendering templates, and displaying information. In a Node.js application, the View is often implemented using templating engines like EJS, Handlebars, or Pug. 12 | 13 | **3. Controller:** The Controller acts as the intermediary between the Model and the View. It receives user input from the View, processes it, and updates the Model or retrieves data from the Model. In Node.js, the Controller is typically implemented as route handlers that handle HTTP requests and manipulate the Model accordingly. 14 | 15 | ## Implementing MVC in a Node.js Project 16 | 17 | To implement the MVC architecture in a Node.js project, we need to ensure proper separation of concerns and the flow of data between the components. Here's a high-level overview of how the components interact in a typical Node.js MVC project: 18 | 19 | 1. The user interacts with the application through the user interface, triggering an HTTP request. 20 | 2. The request is routed to the appropriate Controller based on the URL and HTTP method. 21 | 3. The Controller receives the request, validates input if necessary, and interacts with the Model to fetch or update data. 22 | 4. Once the Model performs the required operations, it notifies the Controller with the result. 23 | 5. The Controller prepares the data to be presented and selects the appropriate View. 24 | 6. The View takes the data and generates an HTML response, which is sent back to the user's browser. 25 | 26 | ## Benefits of MVC Architecture 27 | 28 | By adopting the MVC architecture in your Node.js project, you can enjoy several benefits: 29 | 30 | 1. Modularity: The separation of concerns makes it easier to understand and modify each component independently, improving code maintainability. 31 | 2. Reusability: The components can be reused across different parts of the application or in future projects, saving development time. 32 | 3. Testability: With well-defined boundaries between the components, it becomes simpler to write unit tests for each component in isolation. 33 | 4. Collaboration: The MVC architecture allows developers to work simultaneously on different components, promoting collaboration within the development team. 34 | 35 | ## MVC Architecture Example: Restaurant Menu 36 | 37 | Let's dive into an example of the MVC architecture by using a restaurant scenario, where we have a menu as the View, a waiter as the Controller, and the kitchen as the Model. This analogy will help us understand how the components interact in a real-world context. 38 | 39 | ## View: Restaurant Menu 40 | 41 | The View component in our example is the restaurant menu, which presents the available dishes and their details to the customers. It focuses on the presentation and user interface aspects. The menu can be implemented using HTML, CSS, and a templating engine like EJS or Handlebars to generate dynamic content. 42 | 43 | The menu view could display information such as: 44 | 45 | - List of dishes with their names, descriptions, and prices. 46 | - Categories or sections for different types of dishes (appetizers, main course, desserts, etc.). 47 | - Additional details like dietary restrictions, ingredients, or customer reviews. 48 | 49 | ## Controller: Waiter 50 | 51 | The Controller component in our example is represented by the waiter, who acts as an intermediary between the customers (user input) and the kitchen (Model). The waiter takes the orders from the customers, communicates them to the kitchen, and brings back the prepared dishes. 52 | 53 | The waiter's responsibilities include: 54 | 55 | - Receiving customer requests and interacting with them to understand their preferences. 56 | - Validating the orders and ensuring they are complete and accurate. 57 | - Communicating the orders to the kitchen staff. 58 | - Notifying the customers about any special instructions or updates on their orders. 59 | 60 | ## Model: Kitchen 61 | 62 | The Model component in our example is the kitchen, where the actual food preparation takes place. It focuses on the data and business logic of the application. The kitchen receives orders from the waiter, prepares the dishes, and informs the waiter once they are ready. 63 | 64 | The kitchen's responsibilities include: 65 | 66 | - Receiving orders from the waiter, including the dishes, quantities, and any specific requests. 67 | - Processing the orders and retrieving the required ingredients. 68 | - Preparing the dishes according to the recipes and cooking instructions. 69 | - Notifying the waiter when the dishes are ready to be served. 70 | 71 | ## Interaction Flow 72 | 73 | Now, let's see how the components interact in our restaurant MVC example: 74 | 75 | 1. A customer looks at the menu (View) and selects the desired dishes. 76 | 2. The customer calls the waiter (Controller) and places the order. 77 | 3. The waiter notes down the order and communicates it to the kitchen (Model). 78 | 4. The kitchen prepares the dishes as per the order and notifies the waiter. 79 | 5. The waiter collects the dishes from the kitchen and serves them to the customer. 80 | 6. The customer enjoys the meal and provides feedback, if any. 81 | 82 | ## Benefits of MVC in the Restaurant Example 83 | 84 | By applying the MVC architecture to our restaurant example, we can experience the following benefits: 85 | 86 | 1. Separation of Concerns: Each component (View, Controller, Model) has a distinct responsibility, making the codebase more organized and easier to understand and maintain. 87 | 88 | 2. Modularity and Reusability: The components can be developed independently and reused in other parts of the application or in future projects. 89 | 90 | 3. Scalability: With the clear separation between components, it becomes easier to add new dishes to the menu, modify existing recipes, or introduce new features without impacting other parts of the system. 91 | 92 | 4. Testability: The individual components (View, Controller, Model) can be tested in isolation, allowing for easier unit testing and ensuring the reliability of the application. 93 | 94 | ## Conclusion 95 | 96 | The MVC architecture provides a structured approach to building Node.js applications, enhancing code organization, scalability, and maintainability. By dividing an application into the Model, View, and Controller, developers can create robust and flexible software. 97 | 98 | Bon appétit and happy coding! 🍽️😄🚀 99 | -------------------------------------------------------------------------------- /05 Setting up the http server/using express framework/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "using-express-framework", 3 | "version": "1.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "using-express-framework", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.18.2" 13 | } 14 | }, 15 | "node_modules/accepts": { 16 | "version": "1.3.8", 17 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", 18 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", 19 | "dependencies": { 20 | "mime-types": "~2.1.34", 21 | "negotiator": "0.6.3" 22 | }, 23 | "engines": { 24 | "node": ">= 0.6" 25 | } 26 | }, 27 | "node_modules/array-flatten": { 28 | "version": "1.1.1", 29 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 30 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" 31 | }, 32 | "node_modules/body-parser": { 33 | "version": "1.20.1", 34 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", 35 | "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", 36 | "dependencies": { 37 | "bytes": "3.1.2", 38 | "content-type": "~1.0.4", 39 | "debug": "2.6.9", 40 | "depd": "2.0.0", 41 | "destroy": "1.2.0", 42 | "http-errors": "2.0.0", 43 | "iconv-lite": "0.4.24", 44 | "on-finished": "2.4.1", 45 | "qs": "6.11.0", 46 | "raw-body": "2.5.1", 47 | "type-is": "~1.6.18", 48 | "unpipe": "1.0.0" 49 | }, 50 | "engines": { 51 | "node": ">= 0.8", 52 | "npm": "1.2.8000 || >= 1.4.16" 53 | } 54 | }, 55 | "node_modules/bytes": { 56 | "version": "3.1.2", 57 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", 58 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", 59 | "engines": { 60 | "node": ">= 0.8" 61 | } 62 | }, 63 | "node_modules/call-bind": { 64 | "version": "1.0.2", 65 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 66 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 67 | "dependencies": { 68 | "function-bind": "^1.1.1", 69 | "get-intrinsic": "^1.0.2" 70 | }, 71 | "funding": { 72 | "url": "https://github.com/sponsors/ljharb" 73 | } 74 | }, 75 | "node_modules/content-disposition": { 76 | "version": "0.5.4", 77 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 78 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", 79 | "dependencies": { 80 | "safe-buffer": "5.2.1" 81 | }, 82 | "engines": { 83 | "node": ">= 0.6" 84 | } 85 | }, 86 | "node_modules/content-type": { 87 | "version": "1.0.5", 88 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", 89 | "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", 90 | "engines": { 91 | "node": ">= 0.6" 92 | } 93 | }, 94 | "node_modules/cookie": { 95 | "version": "0.5.0", 96 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", 97 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", 98 | "engines": { 99 | "node": ">= 0.6" 100 | } 101 | }, 102 | "node_modules/cookie-signature": { 103 | "version": "1.0.6", 104 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 105 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" 106 | }, 107 | "node_modules/debug": { 108 | "version": "2.6.9", 109 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 110 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 111 | "dependencies": { 112 | "ms": "2.0.0" 113 | } 114 | }, 115 | "node_modules/depd": { 116 | "version": "2.0.0", 117 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", 118 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", 119 | "engines": { 120 | "node": ">= 0.8" 121 | } 122 | }, 123 | "node_modules/destroy": { 124 | "version": "1.2.0", 125 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", 126 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", 127 | "engines": { 128 | "node": ">= 0.8", 129 | "npm": "1.2.8000 || >= 1.4.16" 130 | } 131 | }, 132 | "node_modules/ee-first": { 133 | "version": "1.1.1", 134 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 135 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" 136 | }, 137 | "node_modules/encodeurl": { 138 | "version": "1.0.2", 139 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 140 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", 141 | "engines": { 142 | "node": ">= 0.8" 143 | } 144 | }, 145 | "node_modules/escape-html": { 146 | "version": "1.0.3", 147 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 148 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" 149 | }, 150 | "node_modules/etag": { 151 | "version": "1.8.1", 152 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 153 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", 154 | "engines": { 155 | "node": ">= 0.6" 156 | } 157 | }, 158 | "node_modules/express": { 159 | "version": "4.18.2", 160 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", 161 | "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", 162 | "dependencies": { 163 | "accepts": "~1.3.8", 164 | "array-flatten": "1.1.1", 165 | "body-parser": "1.20.1", 166 | "content-disposition": "0.5.4", 167 | "content-type": "~1.0.4", 168 | "cookie": "0.5.0", 169 | "cookie-signature": "1.0.6", 170 | "debug": "2.6.9", 171 | "depd": "2.0.0", 172 | "encodeurl": "~1.0.2", 173 | "escape-html": "~1.0.3", 174 | "etag": "~1.8.1", 175 | "finalhandler": "1.2.0", 176 | "fresh": "0.5.2", 177 | "http-errors": "2.0.0", 178 | "merge-descriptors": "1.0.1", 179 | "methods": "~1.1.2", 180 | "on-finished": "2.4.1", 181 | "parseurl": "~1.3.3", 182 | "path-to-regexp": "0.1.7", 183 | "proxy-addr": "~2.0.7", 184 | "qs": "6.11.0", 185 | "range-parser": "~1.2.1", 186 | "safe-buffer": "5.2.1", 187 | "send": "0.18.0", 188 | "serve-static": "1.15.0", 189 | "setprototypeof": "1.2.0", 190 | "statuses": "2.0.1", 191 | "type-is": "~1.6.18", 192 | "utils-merge": "1.0.1", 193 | "vary": "~1.1.2" 194 | }, 195 | "engines": { 196 | "node": ">= 0.10.0" 197 | } 198 | }, 199 | "node_modules/finalhandler": { 200 | "version": "1.2.0", 201 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", 202 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", 203 | "dependencies": { 204 | "debug": "2.6.9", 205 | "encodeurl": "~1.0.2", 206 | "escape-html": "~1.0.3", 207 | "on-finished": "2.4.1", 208 | "parseurl": "~1.3.3", 209 | "statuses": "2.0.1", 210 | "unpipe": "~1.0.0" 211 | }, 212 | "engines": { 213 | "node": ">= 0.8" 214 | } 215 | }, 216 | "node_modules/forwarded": { 217 | "version": "0.2.0", 218 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", 219 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", 220 | "engines": { 221 | "node": ">= 0.6" 222 | } 223 | }, 224 | "node_modules/fresh": { 225 | "version": "0.5.2", 226 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 227 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", 228 | "engines": { 229 | "node": ">= 0.6" 230 | } 231 | }, 232 | "node_modules/function-bind": { 233 | "version": "1.1.1", 234 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 235 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 236 | }, 237 | "node_modules/get-intrinsic": { 238 | "version": "1.2.1", 239 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", 240 | "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", 241 | "dependencies": { 242 | "function-bind": "^1.1.1", 243 | "has": "^1.0.3", 244 | "has-proto": "^1.0.1", 245 | "has-symbols": "^1.0.3" 246 | }, 247 | "funding": { 248 | "url": "https://github.com/sponsors/ljharb" 249 | } 250 | }, 251 | "node_modules/has": { 252 | "version": "1.0.3", 253 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 254 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 255 | "dependencies": { 256 | "function-bind": "^1.1.1" 257 | }, 258 | "engines": { 259 | "node": ">= 0.4.0" 260 | } 261 | }, 262 | "node_modules/has-proto": { 263 | "version": "1.0.1", 264 | "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", 265 | "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", 266 | "engines": { 267 | "node": ">= 0.4" 268 | }, 269 | "funding": { 270 | "url": "https://github.com/sponsors/ljharb" 271 | } 272 | }, 273 | "node_modules/has-symbols": { 274 | "version": "1.0.3", 275 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 276 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", 277 | "engines": { 278 | "node": ">= 0.4" 279 | }, 280 | "funding": { 281 | "url": "https://github.com/sponsors/ljharb" 282 | } 283 | }, 284 | "node_modules/http-errors": { 285 | "version": "2.0.0", 286 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", 287 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", 288 | "dependencies": { 289 | "depd": "2.0.0", 290 | "inherits": "2.0.4", 291 | "setprototypeof": "1.2.0", 292 | "statuses": "2.0.1", 293 | "toidentifier": "1.0.1" 294 | }, 295 | "engines": { 296 | "node": ">= 0.8" 297 | } 298 | }, 299 | "node_modules/iconv-lite": { 300 | "version": "0.4.24", 301 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 302 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 303 | "dependencies": { 304 | "safer-buffer": ">= 2.1.2 < 3" 305 | }, 306 | "engines": { 307 | "node": ">=0.10.0" 308 | } 309 | }, 310 | "node_modules/inherits": { 311 | "version": "2.0.4", 312 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 313 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 314 | }, 315 | "node_modules/ipaddr.js": { 316 | "version": "1.9.1", 317 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 318 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", 319 | "engines": { 320 | "node": ">= 0.10" 321 | } 322 | }, 323 | "node_modules/media-typer": { 324 | "version": "0.3.0", 325 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 326 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", 327 | "engines": { 328 | "node": ">= 0.6" 329 | } 330 | }, 331 | "node_modules/merge-descriptors": { 332 | "version": "1.0.1", 333 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 334 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" 335 | }, 336 | "node_modules/methods": { 337 | "version": "1.1.2", 338 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 339 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", 340 | "engines": { 341 | "node": ">= 0.6" 342 | } 343 | }, 344 | "node_modules/mime": { 345 | "version": "1.6.0", 346 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 347 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", 348 | "bin": { 349 | "mime": "cli.js" 350 | }, 351 | "engines": { 352 | "node": ">=4" 353 | } 354 | }, 355 | "node_modules/mime-db": { 356 | "version": "1.52.0", 357 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 358 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 359 | "engines": { 360 | "node": ">= 0.6" 361 | } 362 | }, 363 | "node_modules/mime-types": { 364 | "version": "2.1.35", 365 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 366 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 367 | "dependencies": { 368 | "mime-db": "1.52.0" 369 | }, 370 | "engines": { 371 | "node": ">= 0.6" 372 | } 373 | }, 374 | "node_modules/ms": { 375 | "version": "2.0.0", 376 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 377 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" 378 | }, 379 | "node_modules/negotiator": { 380 | "version": "0.6.3", 381 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", 382 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", 383 | "engines": { 384 | "node": ">= 0.6" 385 | } 386 | }, 387 | "node_modules/object-inspect": { 388 | "version": "1.12.3", 389 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", 390 | "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", 391 | "funding": { 392 | "url": "https://github.com/sponsors/ljharb" 393 | } 394 | }, 395 | "node_modules/on-finished": { 396 | "version": "2.4.1", 397 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", 398 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", 399 | "dependencies": { 400 | "ee-first": "1.1.1" 401 | }, 402 | "engines": { 403 | "node": ">= 0.8" 404 | } 405 | }, 406 | "node_modules/parseurl": { 407 | "version": "1.3.3", 408 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 409 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", 410 | "engines": { 411 | "node": ">= 0.8" 412 | } 413 | }, 414 | "node_modules/path-to-regexp": { 415 | "version": "0.1.7", 416 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 417 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" 418 | }, 419 | "node_modules/proxy-addr": { 420 | "version": "2.0.7", 421 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 422 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", 423 | "dependencies": { 424 | "forwarded": "0.2.0", 425 | "ipaddr.js": "1.9.1" 426 | }, 427 | "engines": { 428 | "node": ">= 0.10" 429 | } 430 | }, 431 | "node_modules/qs": { 432 | "version": "6.11.0", 433 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", 434 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", 435 | "dependencies": { 436 | "side-channel": "^1.0.4" 437 | }, 438 | "engines": { 439 | "node": ">=0.6" 440 | }, 441 | "funding": { 442 | "url": "https://github.com/sponsors/ljharb" 443 | } 444 | }, 445 | "node_modules/range-parser": { 446 | "version": "1.2.1", 447 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 448 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", 449 | "engines": { 450 | "node": ">= 0.6" 451 | } 452 | }, 453 | "node_modules/raw-body": { 454 | "version": "2.5.1", 455 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", 456 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", 457 | "dependencies": { 458 | "bytes": "3.1.2", 459 | "http-errors": "2.0.0", 460 | "iconv-lite": "0.4.24", 461 | "unpipe": "1.0.0" 462 | }, 463 | "engines": { 464 | "node": ">= 0.8" 465 | } 466 | }, 467 | "node_modules/safe-buffer": { 468 | "version": "5.2.1", 469 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 470 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 471 | "funding": [ 472 | { 473 | "type": "github", 474 | "url": "https://github.com/sponsors/feross" 475 | }, 476 | { 477 | "type": "patreon", 478 | "url": "https://www.patreon.com/feross" 479 | }, 480 | { 481 | "type": "consulting", 482 | "url": "https://feross.org/support" 483 | } 484 | ] 485 | }, 486 | "node_modules/safer-buffer": { 487 | "version": "2.1.2", 488 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 489 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 490 | }, 491 | "node_modules/send": { 492 | "version": "0.18.0", 493 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", 494 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", 495 | "dependencies": { 496 | "debug": "2.6.9", 497 | "depd": "2.0.0", 498 | "destroy": "1.2.0", 499 | "encodeurl": "~1.0.2", 500 | "escape-html": "~1.0.3", 501 | "etag": "~1.8.1", 502 | "fresh": "0.5.2", 503 | "http-errors": "2.0.0", 504 | "mime": "1.6.0", 505 | "ms": "2.1.3", 506 | "on-finished": "2.4.1", 507 | "range-parser": "~1.2.1", 508 | "statuses": "2.0.1" 509 | }, 510 | "engines": { 511 | "node": ">= 0.8.0" 512 | } 513 | }, 514 | "node_modules/send/node_modules/ms": { 515 | "version": "2.1.3", 516 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 517 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 518 | }, 519 | "node_modules/serve-static": { 520 | "version": "1.15.0", 521 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", 522 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", 523 | "dependencies": { 524 | "encodeurl": "~1.0.2", 525 | "escape-html": "~1.0.3", 526 | "parseurl": "~1.3.3", 527 | "send": "0.18.0" 528 | }, 529 | "engines": { 530 | "node": ">= 0.8.0" 531 | } 532 | }, 533 | "node_modules/setprototypeof": { 534 | "version": "1.2.0", 535 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 536 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 537 | }, 538 | "node_modules/side-channel": { 539 | "version": "1.0.4", 540 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 541 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 542 | "dependencies": { 543 | "call-bind": "^1.0.0", 544 | "get-intrinsic": "^1.0.2", 545 | "object-inspect": "^1.9.0" 546 | }, 547 | "funding": { 548 | "url": "https://github.com/sponsors/ljharb" 549 | } 550 | }, 551 | "node_modules/statuses": { 552 | "version": "2.0.1", 553 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", 554 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", 555 | "engines": { 556 | "node": ">= 0.8" 557 | } 558 | }, 559 | "node_modules/toidentifier": { 560 | "version": "1.0.1", 561 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 562 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", 563 | "engines": { 564 | "node": ">=0.6" 565 | } 566 | }, 567 | "node_modules/type-is": { 568 | "version": "1.6.18", 569 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 570 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 571 | "dependencies": { 572 | "media-typer": "0.3.0", 573 | "mime-types": "~2.1.24" 574 | }, 575 | "engines": { 576 | "node": ">= 0.6" 577 | } 578 | }, 579 | "node_modules/unpipe": { 580 | "version": "1.0.0", 581 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 582 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", 583 | "engines": { 584 | "node": ">= 0.8" 585 | } 586 | }, 587 | "node_modules/utils-merge": { 588 | "version": "1.0.1", 589 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 590 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", 591 | "engines": { 592 | "node": ">= 0.4.0" 593 | } 594 | }, 595 | "node_modules/vary": { 596 | "version": "1.1.2", 597 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 598 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", 599 | "engines": { 600 | "node": ">= 0.8" 601 | } 602 | } 603 | } 604 | } 605 | --------------------------------------------------------------------------------