├── .idea
├── .gitignore
├── modules.xml
├── nodejs-course.iml
└── vcs.xml
├── 01 - JS Basics
├── 01_variables.js
├── 02_math.js
├── 03_strings.js
├── 04_arrays.js
├── 05_objects.js
├── 06_conditions.js
├── 07_loops.js
└── 08_functions.js
├── 02 - Async JS
├── 01 - Async
│ └── 01_async.js
├── 02 - Callback
│ ├── 02_callback.js
│ ├── 03_callback.js
│ └── 04_callback.js
├── 03 - Promise
│ ├── 05_promise.js
│ └── 06_promise.js
├── 04 - AsyncAwait
│ ├── 07_async_await.js
│ └── 08_async_await.js
├── 05 - Combination
│ ├── 09_awaitawait_of_promise.js
│ ├── 10_promise_in_async.js
│ ├── 11_callback_in_async.js
│ ├── 12_async_callback.js
│ └── data
│ │ ├── cities.json
│ │ ├── products.json
│ │ └── stores.json
├── 06 - Promisify
│ ├── 13_promisify.js
│ ├── 14_promisify.js
│ ├── data.txt
│ └── data
│ │ ├── cities.json
│ │ ├── products.json
│ │ └── stores.json
└── data
│ ├── cities.json
│ ├── products.json
│ └── stores.json
├── 03 - Nodejs Basics
├── 01 - Nodejs Server
│ ├── 01_nodejs_server.js
│ ├── 02_nodejs_server.js
│ ├── 03_nodejs_server.js
│ ├── 04_nodejs_server.js
│ └── 05_nodejs_server.js
├── 02 - V8 Call Stack
│ ├── 06_callstack.js
│ └── 07_callstack.js
└── 03 - Event Loop
│ ├── 08_event_loop.js
│ ├── 09_os_delegation.js
│ └── 10_loop_tick.js
├── 04 - Local Modules
├── 01 - Import Data
│ ├── data
│ │ ├── cities.json
│ │ ├── products.json
│ │ └── stores.json
│ └── import_data.js
└── 02 - Import Module
│ ├── Method 1
│ ├── app.js
│ └── modules
│ │ ├── multiply.js
│ │ └── sum.js
│ ├── Method 2
│ ├── app.js
│ └── modules
│ │ └── math.js
│ ├── Method 3
│ ├── app.js
│ └── modules
│ │ └── math
│ │ ├── index.js
│ │ ├── math.js
│ │ ├── multiply.js
│ │ └── sum.js
│ └── Tricks and Examples
│ ├── Import Variables
│ ├── app.js
│ └── configs
│ │ ├── database.js
│ │ └── secret_keys.json
│ ├── Restructuring
│ ├── app.js
│ ├── app2.js
│ └── modules
│ │ └── math
│ │ ├── index.js
│ │ ├── multiply.js
│ │ └── sum.js
│ └── Sequence of Exposing
│ ├── app.js
│ └── modules
│ └── math
│ ├── division.js
│ ├── index.js
│ ├── multiply.js
│ └── sum.js
├── 05 - Core Modules
├── 01 - Built-in Global
│ └── 01_builtin_globals.js
├── 02 - Event Emitter
│ ├── 02_event_listener.js
│ └── 03_event_emitter.js
├── 03 - File System
│ ├── 04_readfile.js
│ ├── 05_opendir.js
│ ├── 06_stat.js
│ ├── 07_open.js
│ ├── 08_writefile.js
│ └── data
│ │ └── text.txt
├── 04 - Streams
│ ├── 09_read_write_pipe.js
│ ├── 10_duplex.js
│ └── data
│ │ ├── input.txt
│ │ └── output.txt
└── 05 - Path
│ ├── 12_global_paths.js
│ ├── 13_cwd.js
│ ├── 14_path_module.js
│ ├── data
│ └── text.txt
│ └── my_modules
│ ├── 11_relative_path.js
│ └── mod.js
├── 06 - NPM
├── Project 1
│ ├── package-lock.json
│ └── package.json
├── Project 2
│ ├── package-lock.json
│ └── package.json
└── npm_commands.txt
├── 07 - Web
└── 01 - Standard Communication Languages
│ ├── grades.html
│ ├── grades.json
│ └── grades.xml
└── 08 - API
├── API Project 01
├── app.js
├── index.js
├── package-lock.json
└── package.json
├── API Project 02
├── app.js
├── configurations
│ └── db.js
├── controllers
│ ├── index.js
│ └── student.js
├── index.js
├── middlewares
│ └── index.js
├── package-lock.json
├── package.json
└── routes
│ ├── index.js
│ └── student.js
└── API Project 03
├── .env
├── Database_Backup
├── books.csv
├── reviewers.csv
├── reviews.csv
└── users.csv
├── app.js
├── configurations
├── db.js
├── index.js
└── private.key
├── controllers
├── auth.js
├── book.js
├── index.js
└── review.js
├── index.js
├── middlewares
├── auth.js
└── index.js
├── models
├── Book.js
├── Review.js
├── Reviewer.js
├── User.js
└── index.js
├── my_modules
└── json_response
│ └── index.js
├── package-lock.json
├── package.json
├── routes
├── auth.js
├── book.js
├── index.js
└── review.js
└── validators
├── index.js
├── review.js
└── user.js
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Editor-based HTTP Client requests
5 | /httpRequests/
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/nodejs-course.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/01 - JS Basics/01_variables.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 4 methods for declaring variable
3 | */
4 |
5 | var1 = "Ahmed";
6 |
7 | var var2 = 0.44;
8 |
9 | let var3 = 45;
10 |
11 | const var4 = "s";
12 |
13 | console.log(var1);
14 | console.log(var2);
15 | console.log(var3);
16 | console.log(var4);
17 |
18 | ////////////////////////////////
19 |
20 | /**
21 | * U must assign a value for the variable as a part of variable declaration
22 | * No default value for a new variable
23 | */
24 |
25 | // wrong
26 | let num;
27 |
28 | // right
29 | let num = null;
30 |
31 | console.log(num);
--------------------------------------------------------------------------------
/01 - JS Basics/02_math.js:
--------------------------------------------------------------------------------
1 | /**
2 | * math operators are * / + - %
3 | */
4 |
5 | const num1 = 5;
6 | const num2 = 4;
7 |
8 | const sum = num1 + num2;
9 | console.log(sum);
10 |
11 | const remain = num1 % num2;
12 | console.log(remain);
13 |
14 | /////////////////////////////////////////
15 |
16 | /**
17 | * Math functions
18 | * using built-in Math class
19 | */
20 |
21 | console.log('round = ', Math.round(5.14));
22 |
23 | console.log('ceil = ', Math.ceil(5.14));
24 |
25 | console.log('floor = ', Math.floor(5.14));
26 |
27 | console.log('absolute value = ', Math.abs(-8));
28 |
29 | /////////////////////////////////////////
30 |
31 | /**
32 | * Math Properties / Constants
33 | * using built-in Math class
34 | */
35 |
36 | console.log('Pi value is =', Math.PI);
--------------------------------------------------------------------------------
/01 - JS Basics/03_strings.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 3 method to define a string: single quotes, double quotes, and backticks
3 | */
4 |
5 | const firstName = 'Ahmed';
6 | const midName = "Ali";
7 | const lastName = `Hosam`;
8 |
9 | ////////////////////////////////////
10 |
11 | // string length
12 | console.log(firstName.length);
13 |
14 | // string indexing
15 | console.log(midName[1]);
16 |
17 | // string concatenation
18 | console.log(firstName + ' ' + midName);
19 | // or using backticks
20 | console.log(`This is for ${firstName} ${midName}, family is ${lastName}`);
21 |
22 | ////////////////////////////////////
23 |
24 | // multi-line text
25 |
26 | const story = "This is my success story\nHow I be success one\nin this world";
27 |
28 | // or using backticks
29 | const song = `Hi to my world
30 | with no more words
31 | rather my words`;
32 |
33 | console.log(story);
34 | console.log(song);
--------------------------------------------------------------------------------
/01 - JS Basics/04_arrays.js:
--------------------------------------------------------------------------------
1 | // define empty array
2 | let arr = [];
3 | // or non empty array
4 | arr = [5, 4];
5 |
6 | // add to array
7 | arr.push(6);
8 |
9 | console.log(arr);
10 |
11 | // array indexing
12 | console.log(arr[0]);
13 |
14 | // array length
15 | console.log(arr.length);
--------------------------------------------------------------------------------
/01 - JS Basics/05_objects.js:
--------------------------------------------------------------------------------
1 | // define an object
2 | const car = {
3 | brand: "BMW",
4 | model: "X5",
5 | year: 2016
6 | };
7 |
8 | // add field to object
9 | car.price = 547154;
10 | car['country'] = 'Germany';
11 |
12 | console.log(car);
13 | console.log(car.brand);
14 | console.log(car['brand']);
15 |
16 | //////////////////
17 |
18 | const cars = [
19 | {
20 | brand: 'Nissan',
21 | model: 'Micra',
22 | year: 2019
23 | },
24 | {
25 | brand: 'MB',
26 | model: 'S-Class',
27 | year: 2020
28 | }
29 | ];
30 |
31 | console.log(cars[1].brand);
--------------------------------------------------------------------------------
/01 - JS Basics/06_conditions.js:
--------------------------------------------------------------------------------
1 | const num = 50;
2 |
3 | if (num == 50) {
4 | console.log('first');
5 | } else if (num > 50) {
6 | console.log('num > 50');
7 | }
8 |
9 |
10 | if (num == "50") {
11 | console.log('equality');
12 | }
13 |
14 | if (num === "50") {
15 | console.log('identical equality');
16 | }
--------------------------------------------------------------------------------
/01 - JS Basics/07_loops.js:
--------------------------------------------------------------------------------
1 | const arr = ['BMW', 'MB', 'Nisan'];
2 |
3 | const len = arr.length;
4 | for (i = 0 ; i < len ; i++) {
5 | console.log(arr[i]);
6 | }
7 |
8 | arr.forEach(element => {
9 | console.log(element);
10 | })
--------------------------------------------------------------------------------
/01 - JS Basics/08_functions.js:
--------------------------------------------------------------------------------
1 | /**
2 | * many ways to define a function
3 | */
4 |
5 | // method 1
6 |
7 | function sum (n, m) {
8 | return n + m;
9 | }
10 |
11 | console.log('sum = ', sum(4, 6));
12 |
13 | ////////////////////////////////
14 |
15 | // method 2 (arrow function)
16 |
17 | // style 1
18 | const multiply = (n, m) => {
19 | return n * m;
20 | }
21 |
22 | // style 2 - for only line block
23 | const division = (n, m) => n / m;
24 |
25 | // style 3
26 | const reminder = function (n, m) {
27 | return n % m;
28 | }
29 |
30 | console.log('multiply = ', multiply(4, 6));
31 | console.log('division = ', division(4, 6));
32 | console.log('reminder = ', reminder(4, 6));
33 |
34 | ////////////////////////////////
35 |
36 | // method 3
37 |
38 | const person = {
39 | firstName: "John",
40 | lastName : "Doe",
41 | id : 5566,
42 | fullName : function () {
43 | return this.firstName + " " + this.lastName;
44 | }
45 | };
46 |
47 | console.log(person);
48 | console.log(person.fullName());
--------------------------------------------------------------------------------
/02 - Async JS/01 - Async/01_async.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 2 types of operations: blocking vs non-blocking
3 | * 2 exec: sync and async (background)
4 | */
5 |
6 |
7 | console.log(1);
8 | console.log(2);
9 |
10 | // async process
11 | /**
12 | * async maybe: timer, long-time process, and I/O operations (files, DB, API's), async
13 | */
14 | setTimeout(() => {
15 | console.log('async');
16 | }, 1000);
17 |
18 | console.log(3);
19 | console.log(4)
--------------------------------------------------------------------------------
/02 - Async JS/02 - Callback/02_callback.js:
--------------------------------------------------------------------------------
1 | const products = require('../data/products.json');
2 | const stores = require('../data/stores.json');
3 | const cities = require('../data/cities.json');
4 |
5 | // async process
6 | const getProductByName = (name, cb) => {
7 | // timer for simulating an async
8 | setTimeout(() => {
9 | const product = products.find(product => product.name === name);
10 | cb(product);
11 | }, 500)
12 | }
13 |
14 | // callback function
15 | const handleGetProductByName = (product) => {
16 | console.log(product);
17 | };
18 |
19 | // run
20 | const testName = "Tea Ahmad";
21 | getProductByName(testName, handleGetProductByName);
22 |
23 | // or
24 | getProductByName(testName, (product) => {
25 | console.log(product);
26 | });
--------------------------------------------------------------------------------
/02 - Async JS/02 - Callback/03_callback.js:
--------------------------------------------------------------------------------
1 | const products = require('../data/products.json');
2 | const stores = require('../data/stores.json');
3 | const cities = require('../data/cities.json');
4 |
5 | /**
6 | * async processes
7 | */
8 | const getProductByName = (name, cb) => {
9 | setTimeout(() => {
10 | const product = products.find(product => product.name === name);
11 | cb(product);
12 | }, 500)
13 | }
14 |
15 | const getStoreById = (id, cb) => {
16 | setTimeout(() => {
17 | const store = stores.find(store => store.id === id);
18 | cb(store);
19 | }, 500)
20 | }
21 |
22 | const getCityByName = (name, cb) => {
23 | setTimeout(() => {
24 | const city = cities.find(city => city.name === name);
25 | cb(city);
26 | }, 500)
27 | }
28 |
29 |
30 | /**
31 | * callbacks and run
32 | */
33 |
34 | const testProductName = "Tea Ahmad";
35 |
36 | getProductByName(testProductName, (product) => {
37 | console.log('product is', product);
38 |
39 | getStoreById(product.store_id, (store) => {
40 | console.log('store is', store);
41 |
42 | getCityByName(store.city, (city) => {
43 | console.log('city is', city);
44 | })
45 | })
46 | })
47 |
48 | // above calls is called "callback hell"
--------------------------------------------------------------------------------
/02 - Async JS/02 - Callback/04_callback.js:
--------------------------------------------------------------------------------
1 | const products = require('../data/products.json');
2 | const stores = require('../data/stores.json');
3 | const cities = require('../data/cities.json');
4 |
5 | /**
6 | * async processes
7 | */
8 | const getProductByName = (name, cb) => {
9 | setTimeout(() => {
10 | const product = products.find(product => product.name === name);
11 | if (product) {
12 | cb(undefined, product);
13 | } else {
14 | err = {message: "Not found", code: 404};
15 | cb(err, null);
16 | }
17 | }, 500)
18 | }
19 |
20 | const getStoreById = (id, cb) => {
21 | setTimeout(() => {
22 | const store = stores.find(store => store.id === id);
23 | if (store) {
24 | cb(undefined, store);
25 | } else {
26 | err = {message: "Not found", code: 404};
27 | cb(err, null);
28 | }
29 | }, 500)
30 | }
31 |
32 | const getCityByName = (name, cb) => {
33 | setTimeout(() => {
34 | const city = cities.find(city => city.name === name);
35 | if (city) {
36 | cb(undefined, city);
37 | } else {
38 | err = {message: "Not found", code: 404};
39 | cb(err, null);
40 | }
41 | }, 500)
42 | }
43 |
44 |
45 | /**
46 | * callbacks and run
47 | */
48 |
49 | const testProductName = "Tea Ahmad";
50 |
51 | getProductByName(testProductName, (err, product) => {
52 | if (err) {
53 | console.log('error in get product is', err);
54 | } else {
55 | console.log('product is', product);
56 |
57 | getStoreById(product.store_id, (err, store) => {
58 | if (err) {
59 | console.log('error in get store is', err);
60 | } else {
61 | console.log('store is', store);
62 |
63 | getCityByName(store.city, (err, city) => {
64 | if (err) {
65 | console.log('error in get city is', err);
66 | } else {
67 | console.log('city is', city);
68 | }
69 | })
70 | }
71 | })
72 | }
73 | })
74 |
75 | // above calls is called "callback hell"
--------------------------------------------------------------------------------
/02 - Async JS/03 - Promise/05_promise.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | // async process
4 | const getProductByName = (name) => {
5 | return new Promise((resolve, reject) => {
6 | const data = fs.readFileSync('./data/products.json');
7 | const json = JSON.parse(data);
8 | const product = json.find(product => product.name === name);
9 |
10 | if (product) {
11 | resolve(product);
12 | } else {
13 | err = {message: "Not found", code: 404};
14 | reject(err);
15 | }
16 | })
17 | }
18 |
19 | // run
20 | getProductByName('Tea Ahmad')
21 | .then(data => {
22 | console.log(data)
23 | }).catch(err => {
24 | console.log(err)
25 | })
--------------------------------------------------------------------------------
/02 - Async JS/03 - Promise/06_promise.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | /**
4 | * async processes
5 | */
6 | const getProductByName = (name) => {
7 | return new Promise((resolve, reject) => {
8 | const data = fs.readFileSync('./data/products.json');
9 | const json = JSON.parse(data);
10 | const product = json.find(product => product.name === name);
11 |
12 | if (product) {
13 | resolve(product);
14 | } else {
15 | err = {message: "Not found", code: 404};
16 | reject(err);
17 | }
18 | })
19 | }
20 |
21 | const getStoreById = (id) => {
22 | return new Promise((resolve, reject) => {
23 | const data = fs.readFileSync('./data/stores.json');
24 | const json = JSON.parse(data);
25 | const store = json.find(store => store.id === id);
26 |
27 | if (store) {
28 | resolve(store);
29 | } else {
30 | err = {message: "Not found", code: 404};
31 | reject(err);
32 | }
33 | })
34 | }
35 |
36 | const getCityByName = (name) => {
37 | return new Promise((resolve, reject) => {
38 | const data = fs.readFileSync('./data/cities.json');
39 | const json = JSON.parse(data);
40 | const city = json.find(city => city.name === name);
41 |
42 | if (city) {
43 | resolve(city);
44 | } else {
45 | err = {message: "Not found", code: 404};
46 | reject(err);
47 | }
48 | })
49 | }
50 |
51 |
52 | // run
53 | // test get city name from product
54 | testProductName = 'Tea Ahmad'
55 |
56 | getProductByName(testProductName).then(product => {
57 | getStoreById(product.store_id).then(store => {
58 | getCityByName(store.city).then(city => {
59 | console.log(city.name);
60 | }).catch(err => {
61 | console.log(err)
62 | })
63 | }).catch(err => {
64 | console.log(err)
65 | })
66 | }).catch(err => {
67 | console.log(err)
68 | })
69 |
70 | // above is like callback hell
71 | // so, the solution is promise chain
72 | // like following
73 |
74 | getProductByName(testProductName).then(product => {
75 | return getStoreById(product.store_id);
76 | }).then(store => {
77 | return getCityByName(store.city)
78 | }).then(city => {
79 | console.log(city.name);
80 | }).catch(err => {
81 | console.log(err)
82 | })
--------------------------------------------------------------------------------
/02 - Async JS/04 - AsyncAwait/07_async_await.js:
--------------------------------------------------------------------------------
1 |
2 | // async
3 | const getUSData = async () => {
4 | const response = await fetch('https://datausa.io/api/data?drilldowns=Nation&measures=Population');
5 |
6 | // error case
7 | if (response.status !== 200) {
8 | throw new Error('cannot fetch the data');
9 | }
10 |
11 | const json = await response.json()
12 | return json;
13 | }
14 |
15 | // run
16 | getUSData()
17 | .then(data => {
18 | console.log(data)
19 | })
20 | .catch(err => {
21 | console.log(err)
22 | })
--------------------------------------------------------------------------------
/02 - Async JS/04 - AsyncAwait/08_async_await.js:
--------------------------------------------------------------------------------
1 | /**
2 | * async usually used to handle returned promise (instead of promise chain)
3 | */
4 |
5 | const fs = require('fs');
6 |
7 | /**
8 | * async processes
9 | */
10 | const getProductByName = (name) => {
11 | return new Promise((resolve, reject) => {
12 | fs.readFile('./data/products.json', 'utf8', (err, data) => {
13 | if (err) {
14 | reject(err);
15 | } else {
16 | const json = JSON.parse(data);
17 | const product = json.find(product => product.name === name);
18 |
19 | if (product) {
20 | resolve(product);
21 | } else {
22 | err = {message: "Not found", code: 404};
23 | reject(err);
24 | }
25 | }
26 | });
27 | })
28 | }
29 |
30 | const getStoreById = (id) => {
31 | return new Promise((resolve, reject) => {
32 | fs.readFile('./data/stores.json', 'utf8', (err, data) => {
33 | if (err) {
34 | reject(err);
35 | } else {
36 | const json = JSON.parse(data);
37 | const store = json.find(store => store.id === id);
38 |
39 | if (store) {
40 | resolve(store);
41 | } else {
42 | err = {message: "Not found", code: 404};
43 | reject(err);
44 | }
45 | }
46 | });
47 | })
48 | }
49 |
50 | const getCityByName = (name) => {
51 | return new Promise((resolve, reject) => {
52 | fs.readFile('./data/cities.json', 'utf8', (err, data) => {
53 | if (err) {
54 | reject(err);
55 | } else {
56 | const json = JSON.parse(data);
57 | const city = json.find(city => city.name === name);
58 |
59 | if (city) {
60 | resolve(city);
61 | } else {
62 | err = {message: "Not found", code: 404};
63 | reject(err);
64 | }
65 | }
66 | });
67 | })
68 | }
69 |
70 |
71 | // promise handling by async
72 |
73 | const getCityFromProduct = async (productName) => {
74 | try {
75 | const product = await getProductByName(productName)
76 | const store = await getStoreById(product.store_id)
77 | const city = await getCityByName(store.city)
78 |
79 | console.log(city)
80 | } catch (err) {
81 | console.log(err.message)
82 | }
83 | }
84 |
85 | getCityFromProduct('Tea Ahmad')
86 |
87 |
88 | /**
89 | * look files 07,08_async
90 | * we notice that you can handle async response within async function, or return async response from async function
91 | * if u handle it within async(), you can access it directly without then,catch
92 | * but if u return it from async(), you will deal with async response as a promise then,catch
93 | */
--------------------------------------------------------------------------------
/02 - Async JS/05 - Combination/09_awaitawait_of_promise.js:
--------------------------------------------------------------------------------
1 | /**
2 | * async usually used to handle returned promise (instead of promise chain)
3 | */
4 |
5 | const fs = require('fs');
6 |
7 | /**
8 | * async processes
9 | */
10 | const getProductByName = (name) => {
11 | return new Promise((resolve, reject) => {
12 | fs.readFile('./data/products.json', 'utf8', (err, data) => {
13 | if (err) {
14 | reject(err);
15 | } else {
16 | const json = JSON.parse(data);
17 | const product = json.find(product => product.name === name);
18 |
19 | if (product) {
20 | resolve(product);
21 | } else {
22 | err = {message: "Not found", code: 404};
23 | reject(err);
24 | }
25 | }
26 | });
27 | })
28 | }
29 |
30 | const getStoreById = (id) => {
31 | return new Promise((resolve, reject) => {
32 | fs.readFile('./data/stores.json', 'utf8', (err, data) => {
33 | if (err) {
34 | reject(err);
35 | } else {
36 | const json = JSON.parse(data);
37 | const store = json.find(store => store.id === id);
38 |
39 | if (store) {
40 | resolve(store);
41 | } else {
42 | err = {message: "Not found", code: 404};
43 | reject(err);
44 | }
45 | }
46 | });
47 | })
48 | }
49 |
50 | const getCityByName = (name) => {
51 | return new Promise((resolve, reject) => {
52 | fs.readFile('./data/cities.json', 'utf8', (err, data) => {
53 | if (err) {
54 | reject(err);
55 | } else {
56 | const json = JSON.parse(data);
57 | const city = json.find(city => city.name === name);
58 |
59 | if (city) {
60 | resolve(city);
61 | } else {
62 | err = {message: "Not found", code: 404};
63 | reject(err);
64 | }
65 | }
66 | });
67 | })
68 | }
69 |
70 |
71 | // promise handling by async
72 |
73 | const getCityFromProduct = async (productName) => {
74 | try {
75 | const product = await getProductByName(productName)
76 | const store = await getStoreById(product.store_id)
77 | const city = await getCityByName(store.city)
78 |
79 | console.log(city)
80 | } catch (err) {
81 | console.log(err.message)
82 | }
83 | }
84 |
85 | getCityFromProduct('Tea Ahmad')
86 |
87 |
88 | /**
89 | * look files 07,08_async
90 | * we notice that you can handle async response within async function, or return async response from async function
91 | * if u handle it within async(), you can access it directly without then,catch
92 | * but if u return it from async(), you will deal with async response as a promise then,catch
93 | */
--------------------------------------------------------------------------------
/02 - Async JS/05 - Combination/10_promise_in_async.js:
--------------------------------------------------------------------------------
1 | const getProductsFromAPI = async () => {
2 | const fetchPromise = fetch('https://mdn.github.io/learning-area/javascript/apis/fetching-data/can-store/products.json');
3 |
4 | console.log(fetchPromise);
5 |
6 | fetchPromise.then((response) => {
7 | console.log(`Received response: ${response.status}`);
8 | });
9 |
10 | console.log("Started request…");
11 | }
12 |
13 | getProductsFromAPI()
--------------------------------------------------------------------------------
/02 - Async JS/05 - Combination/11_callback_in_async.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | const getProductByName = async (name, cb) => {
4 | // await is optional, but it must be used when there are other lines after this line
5 | fs.readFile('./data/products.json', 'utf8', (err, data) => {
6 | if (err) {
7 | cb(err, null)
8 | } else {
9 | cb(undefined, data)
10 | }
11 | })
12 | }
13 |
14 | const handleGetProductByName = (err, product) => {
15 | if (err) {
16 | console.log(err.message);
17 | } else {
18 | console.log(product);
19 | }
20 | }
21 |
22 | getProductByName('Tea Ahmad', handleGetProductByName)
23 |
--------------------------------------------------------------------------------
/02 - Async JS/05 - Combination/12_async_callback.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | const getProductByName = (name, cb) => {
4 | fs.readFile('./data/products.json', 'utf8', (err, data) => {
5 | if (err) {
6 | cb(err, null)
7 | } else {
8 | const json = JSON.parse(data);
9 | const product = json.find(product => product.name === name)
10 | cb(undefined, product)
11 | }
12 | })
13 | }
14 |
15 | const handleGetProductAndThenGetStore = async (err, product) => {
16 | if (err) {
17 | console.log(err.message);
18 | } else {
19 | console.log(product);
20 |
21 | await fs.readFile('./data/stores.json', 'utf8', (err, data) => {
22 | if (err) {
23 | console.log(err.message);
24 | } else {
25 | const json = JSON.parse(data);
26 | const store = json.find(store => store.id === product.store_id)
27 | console.log(store);
28 | }
29 | })
30 | }
31 | }
32 |
33 | getProductByName('Tea Ahmad', handleGetProductAndThenGetStore)
34 |
--------------------------------------------------------------------------------
/02 - Async JS/05 - Combination/data/cities.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Gaza",
5 | "location": "31.512991887430243, 34.43016822530132"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Rafah",
10 | "location": "31.311206673845238, 34.25865428796455"
11 | }
12 | ]
--------------------------------------------------------------------------------
/02 - Async JS/05 - Combination/data/products.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Coffee Star",
4 | "price": 14.55,
5 | "discount": 0,
6 | "store_id": 1
7 | },
8 | {
9 | "name": "Tea Ahmad",
10 | "price": 7.8,
11 | "discount": 0.5,
12 | "store_id": 1
13 | },
14 | {
15 | "name": "Chok moka",
16 | "price": 1.14,
17 | "discount": 0,
18 | "store_id": 2
19 | }
20 | ]
--------------------------------------------------------------------------------
/02 - Async JS/05 - Combination/data/stores.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Ali Baik Store",
5 | "city": "Gaza"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Catch store",
10 | "city": "Rafah"
11 | }
12 | ]
--------------------------------------------------------------------------------
/02 - Async JS/06 - Promisify/13_promisify.js:
--------------------------------------------------------------------------------
1 | const { readFile } = require('fs')
2 | const { promisify } = require('util')
3 |
4 | /*
5 | readFile('./data.txt', 'utf8', (err, data) => {
6 | if (err) {
7 | console.log(err.message);
8 | return;
9 | }
10 |
11 | console.log(data)
12 | })
13 | */
14 |
15 | const pReadFile = promisify(readFile);
16 |
17 | pReadFile('./data.txt', 'utf8')
18 | .then(data => {
19 | console.log(data)
20 | })
21 | .catch(err => {
22 | console.log(err.message)
23 | })
--------------------------------------------------------------------------------
/02 - Async JS/06 - Promisify/14_promisify.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | const { promisify } = require('util')
3 |
4 | const getProductByName = (name, cb) => {
5 | fs.readFile('./data/products.json', 'utf8', (err, data) => {
6 | if (err) {
7 | cb(err, null)
8 | } else {
9 | const json = JSON.parse(data)
10 | const product = json.find(product => product.name === name)
11 | cb(undefined, product)
12 | }
13 | })
14 | }
15 |
16 | const findProduct = promisify(getProductByName)
17 |
18 | findProduct('Tea Ahmad')
19 | .then(product => {
20 | console.log(product)
21 | })
22 | .catch(err => {
23 | console.log(err.message)
24 | })
--------------------------------------------------------------------------------
/02 - Async JS/06 - Promisify/data.txt:
--------------------------------------------------------------------------------
1 | Hello world
2 | my nodejs app
--------------------------------------------------------------------------------
/02 - Async JS/06 - Promisify/data/cities.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Gaza",
5 | "location": "31.512991887430243, 34.43016822530132"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Rafah",
10 | "location": "31.311206673845238, 34.25865428796455"
11 | }
12 | ]
--------------------------------------------------------------------------------
/02 - Async JS/06 - Promisify/data/products.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Coffee Star",
4 | "price": 14.55,
5 | "discount": 0,
6 | "store_id": 1
7 | },
8 | {
9 | "name": "Tea Ahmad",
10 | "price": 7.8,
11 | "discount": 0.5,
12 | "store_id": 1
13 | },
14 | {
15 | "name": "Chok moka",
16 | "price": 1.14,
17 | "discount": 0,
18 | "store_id": 2
19 | }
20 | ]
--------------------------------------------------------------------------------
/02 - Async JS/06 - Promisify/data/stores.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Ali Baik Store",
5 | "city": "Gaza"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Catch store",
10 | "city": "Rafah"
11 | }
12 | ]
--------------------------------------------------------------------------------
/02 - Async JS/data/cities.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Gaza",
5 | "location": "31.512991887430243, 34.43016822530132"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Rafah",
10 | "location": "31.311206673845238, 34.25865428796455"
11 | }
12 | ]
--------------------------------------------------------------------------------
/02 - Async JS/data/products.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Coffee Star",
4 | "price": 14.55,
5 | "discount": 0,
6 | "store_id": 1
7 | },
8 | {
9 | "name": "Tea Ahmad",
10 | "price": 7.8,
11 | "discount": 0.5,
12 | "store_id": 1
13 | },
14 | {
15 | "name": "Chok moka",
16 | "price": 1.14,
17 | "discount": 0,
18 | "store_id": 2
19 | }
20 | ]
--------------------------------------------------------------------------------
/02 - Async JS/data/stores.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Ali Baik Store",
5 | "city": "Gaza"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Catch store",
10 | "city": "Rafah"
11 | }
12 | ]
--------------------------------------------------------------------------------
/03 - Nodejs Basics/01 - Nodejs Server/01_nodejs_server.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 |
3 | const port = 5050
4 |
5 | const server = http.createServer();
6 |
7 | server.listen(port, () => {
8 | console.log(`server is now listening on port ${port}`)
9 | })
10 |
11 | // http://localhost:5050
--------------------------------------------------------------------------------
/03 - Nodejs Basics/01 - Nodejs Server/02_nodejs_server.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 |
3 | const port = 5050
4 |
5 | const server = http.createServer((req, res) => {
6 | res.end('Welcome to page');
7 | });
8 |
9 | server.listen(port, () => {
10 | console.log(`server is now listening on port ${port}`)
11 | })
--------------------------------------------------------------------------------
/03 - Nodejs Basics/01 - Nodejs Server/03_nodejs_server.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 |
3 | const port = 5050
4 |
5 | const server = http.createServer((req, res) => {
6 | res.end(`
7 |
8 |
9 | My first page
10 |
11 |
12 | Welcome to my node application
13 |
14 |
15 | `);
16 | });
17 |
18 | server.listen(port, () => {
19 | console.log(`server is now listening on port ${port}`)
20 | })
--------------------------------------------------------------------------------
/03 - Nodejs Basics/01 - Nodejs Server/04_nodejs_server.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 |
3 | const port = 5050
4 |
5 | const server = http.createServer((req, res) => {
6 | switch (req.url) {
7 | case '/':
8 | res.end(`
9 |
10 |
11 | My first page
12 |
13 |
14 | Welcome to my node application
15 |
16 |
17 | `);
18 | break;
19 | case 'user':
20 | res.end('User page, welcome');
21 | break;
22 | case 'admin':
23 | res.end('Employee good morning');
24 | break;
25 | default:
26 | res.end('Page not found');
27 | break;
28 | }
29 |
30 | });
31 |
32 | server.listen(port, () => {
33 | console.log(`server is now listening on port ${port}`)
34 | })
--------------------------------------------------------------------------------
/03 - Nodejs Basics/01 - Nodejs Server/05_nodejs_server.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 |
3 | const port = 5050
4 |
5 | /**
6 | * simulate an error
7 | * and stop the process
8 | */
9 | const someError = true
10 |
11 | if (someError) {
12 | process.exit(1)
13 | }
14 |
15 |
16 | /**
17 | * create Node.js http server with handling multi urls
18 | */
19 | const server = http.createServer((req, res) => {
20 | switch (req.url) {
21 | case '/':
22 | res.end(`
23 |
24 |
25 | My first page
26 |
27 |
28 | Welcome to my node application
29 |
30 |
31 | `);
32 | break;
33 | case 'user':
34 | res.end('User page, welcome');
35 | break;
36 | case 'admin':
37 | res.end('Employee good morning');
38 | break;
39 | default: // not defined url
40 | res.end('Page not found');
41 | break;
42 | }
43 |
44 | });
45 |
46 | /**
47 | * listen to requests
48 | */
49 | server.listen(port, () => {
50 | console.log(`server is now listening on port ${port}`)
51 | })
--------------------------------------------------------------------------------
/03 - Nodejs Basics/02 - V8 Call Stack/06_callstack.js:
--------------------------------------------------------------------------------
1 | console.log('first line');
2 | console.log('second line');
3 | console.log('third line');
4 | console.log('forth line');
5 |
--------------------------------------------------------------------------------
/03 - Nodejs Basics/02 - V8 Call Stack/07_callstack.js:
--------------------------------------------------------------------------------
1 | const cee = () => {
2 | console.log('output is', 'cee');
3 | }
4 |
5 | const boo = () => {
6 | console.log('output is', 'boo');
7 | cee();
8 | }
9 |
10 | const foo = () => {
11 | console.log('output is', 'foo')
12 | boo();
13 | }
14 |
15 | ////////////////
16 |
17 | console.log('output is', 'running')
18 | cee()
19 | foo();
--------------------------------------------------------------------------------
/03 - Nodejs Basics/03 - Event Loop/08_event_loop.js:
--------------------------------------------------------------------------------
1 | const { pbkdf2 } = require('crypto')
2 |
3 | const start = Date.now()
4 |
5 | const hash = () => {
6 | pbkdf2('password', 'solt', 10000, 1000, 'sha256', () => {
7 | console.log('Hash', Date.now() - start)
8 | })
9 | }
10 |
11 | hash();
12 | hash();
13 | hash();
14 | hash();
--------------------------------------------------------------------------------
/03 - Nodejs Basics/03 - Event Loop/09_os_delegation.js:
--------------------------------------------------------------------------------
1 | const { pbkdf2 } = require('crypto')
2 | const { createServer } = require('http')
3 |
4 | const start = Date.now()
5 |
6 | const hash = () => {
7 | pbkdf2('password', 'solt', 10000, 1000, 'sha256', () => {
8 | console.log('Hash', Date.now() - start)
9 | })
10 | }
11 |
12 | const lis = () => {
13 | createServer().listen(3000, () => {
14 | console.log('listening', Date.now() - start)
15 | })
16 | }
17 |
18 | hash();
19 | hash();
20 | hash();
21 | hash();
22 | lis();
--------------------------------------------------------------------------------
/03 - Nodejs Basics/03 - Event Loop/10_loop_tick.js:
--------------------------------------------------------------------------------
1 | const { pbkdf2 } = require('crypto')
2 |
3 | const start = Date.now()
4 |
5 | const hash = () => {
6 | pbkdf2('password', 'solt', 10, 1000, 'sha256', () => {
7 | console.log('Hash', Date.now() - start)
8 | })
9 | }
10 |
11 | setImmediate(() => {
12 | console.log('setImmediate', Date.now() - start)
13 | }, "Educative")
14 |
15 |
16 | hash();
17 |
18 | process.nextTick(() => {
19 | console.log('nextTick', Date.now() - start)
20 | })
21 |
22 | hash();
23 | hash();
24 | hash();
25 |
--------------------------------------------------------------------------------
/04 - Local Modules/01 - Import Data/data/cities.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Gaza",
5 | "location": "31.512991887430243, 34.43016822530132"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Rafah",
10 | "location": "31.311206673845238, 34.25865428796455"
11 | }
12 | ]
--------------------------------------------------------------------------------
/04 - Local Modules/01 - Import Data/data/products.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "Coffee Star",
4 | "price": 14.55,
5 | "discount": 0,
6 | "store_id": 1
7 | },
8 | {
9 | "name": "Tea Ahmad",
10 | "price": 7.8,
11 | "discount": 0.5,
12 | "store_id": 1
13 | },
14 | {
15 | "name": "Chok moka",
16 | "price": 1.14,
17 | "discount": 0,
18 | "store_id": 2
19 | }
20 | ]
--------------------------------------------------------------------------------
/04 - Local Modules/01 - Import Data/data/stores.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": 1,
4 | "name": "Ali Baik Store",
5 | "city": "Gaza"
6 | },
7 | {
8 | "id": 2,
9 | "name": "Catch store",
10 | "city": "Rafah"
11 | }
12 | ]
--------------------------------------------------------------------------------
/04 - Local Modules/01 - Import Data/import_data.js:
--------------------------------------------------------------------------------
1 | /**
2 | * you can get a data from a file using fs
3 | * but also u can get it by "importing", using require() function + relative path
4 | */
5 |
6 |
7 | // require json file + auto converted to array of objects
8 | const products = require('./data/products.json');
9 |
10 | console.log(products);
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 1/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * import a function from a file contains only it
3 | */
4 | const sum = require('./modules/sum')
5 | const multiply = require('./modules/multiply')
6 |
7 | const val1 = 5;
8 | const val2 = 7;
9 |
10 | const sumResult = sum(val1, val2);
11 | console.log(`sum of ${val1} and ${val2} is ${sumResult}`)
12 |
13 | const multiplyResult = multiply(val1, val2);
14 | console.log(`multiply of ${val1} and ${val2} is ${multiplyResult}`)
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 1/modules/multiply.js:
--------------------------------------------------------------------------------
1 | const multiply = (a, b) => {
2 | return a * b;
3 | }
4 |
5 | module.exports = multiply;
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 1/modules/sum.js:
--------------------------------------------------------------------------------
1 | const sum = (a, b) => {
2 | return a + b;
3 | }
4 |
5 | module.exports = sum;
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 2/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * import some functions from a file contains many
3 | */
4 | const math = require('./modules/math')
5 |
6 | const val1 = 5;
7 | const val2 = 7;
8 |
9 | const sumResult = math.sum(val1, val2);
10 | console.log(`sum of ${val1} and ${val2} is ${sumResult}`)
11 |
12 | const multiplyResult = math.multiply(val1, val2);
13 | console.log(`multiply of ${val1} and ${val2} is ${multiplyResult}`)
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 2/modules/math.js:
--------------------------------------------------------------------------------
1 | const sum = (a, b) => {
2 | return a + b;
3 | }
4 |
5 | const multiply = (a, b) => {
6 | return a * b;
7 | }
8 |
9 | // use an object; not array. to be able to use function later by name; not index
10 | module.exports = {
11 | sum, // key is default = function name
12 | mp: multiply
13 | };
14 |
15 |
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 3/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * import some functions from a folder contains many + index file
3 | */
4 | const math = require('./modules/math/math')
5 | // or
6 | // const math = require('./modules/math') # index.js
7 |
8 | const val1 = 5;
9 | const val2 = 7;
10 |
11 | const sumResult = math.sum(val1, val2);
12 | console.log(`sum of ${val1} and ${val2} is ${sumResult}`)
13 |
14 | const multiplyResult = math.multiply(val1, val2);
15 | console.log(`multiply of ${val1} and ${val2} is ${multiplyResult}`)
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 3/modules/math/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | sum: require('./sum'),
3 | multiply: require('./multiply')
4 | };
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 3/modules/math/math.js:
--------------------------------------------------------------------------------
1 | const sum = require('./sum');
2 | const multiply = require('./multiply')
3 |
4 | module.exports = {
5 | sum,
6 | multiply
7 | }
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 3/modules/math/multiply.js:
--------------------------------------------------------------------------------
1 | const multiply = (a, b) => {
2 | return a * b;
3 | }
4 |
5 | module.exports = multiply;
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Method 3/modules/math/sum.js:
--------------------------------------------------------------------------------
1 | const sum = (a, b) => {
2 | return a + b;
3 | }
4 |
5 | module.exports = sum;
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Import Variables/app.js:
--------------------------------------------------------------------------------
1 | // import variables as import file
2 | const secret = require('./configs/secret_keys.json')
3 |
4 | // import variables as module
5 | const dbConfig = require('./configs/database')
6 |
7 |
8 | console.log('server key is', secret.server_key)
9 |
10 | console.log('db host is', dbConfig.host)
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Import Variables/configs/database.js:
--------------------------------------------------------------------------------
1 | const databaseConfig = {
2 | host: "localhost",
3 | driver: "mysql",
4 | database: "test",
5 | username: "root",
6 | password: ""
7 | }
8 |
9 | module.exports = databaseConfig
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Import Variables/configs/secret_keys.json:
--------------------------------------------------------------------------------
1 | {
2 | "server_key": "AAAABBBCCC",
3 | "host_ip": "127.0.0.1"
4 | }
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Restructuring/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * import some functions from a folder contains many + index file
3 | */
4 | const math = require('./modules/math')
5 |
6 | // restructure
7 | const { sum } = require('./modules/math')
8 | const { multiply } = require('./modules/math')
9 | // or
10 | // const { sum, multiply } = require('./modules/math')
11 |
12 |
13 | const val1 = 5;
14 | const val2 = 7;
15 |
16 | // math.sum
17 | const sumResult = math.sum(val1, val2);
18 | console.log(`sum of ${val1} and ${val2} is ${sumResult}`)
19 |
20 | // sum
21 | const sumResult2 = sum(val1, val2);
22 | console.log(`sum of ${val1} and ${val2} is ${sumResult2}`)
23 |
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Restructuring/app2.js:
--------------------------------------------------------------------------------
1 | const { sum } = require('./modules/math')
2 | const { multiply } = require('./modules/math')
3 | // or
4 | // const { sum, multiply } = require('./modules/math')
5 |
6 | const sumResult = sum(val1, val2);
7 | console.log(`sum of ${val1} and ${val2} is ${sumResult}`)
8 |
9 | const multiplyResult = multiply(val1, val2);
10 | console.log(`multiply of ${val1} and ${val2} is ${multiplyResult}`)
11 |
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Restructuring/modules/math/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | sum: require('./sum'), // function
3 | multiply: require('./multiply'), // function
4 | };
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Restructuring/modules/math/multiply.js:
--------------------------------------------------------------------------------
1 | const multiply = (a, b) => {
2 | return a * b;
3 | }
4 |
5 | module.exports = multiply;
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Restructuring/modules/math/sum.js:
--------------------------------------------------------------------------------
1 | const sum = (a, b) => {
2 | return a + b;
3 | }
4 |
5 | module.exports = sum;
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Sequence of Exposing/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * import some functions from a folder contains many + index file
3 | */
4 | const math = require('./modules/math')
5 |
6 | // restructure
7 | const { sum } = require('./modules/math')
8 | const { multiply, division, reminder } = require('./modules/math')
9 |
10 | const val1 = 5;
11 | const val2 = 7;
12 |
13 | // math.sum
14 | const sumResult = math.sum(val1, val2);
15 | console.log(`sum of ${val1} and ${val2} is ${sumResult}`)
16 |
17 | // sum
18 | const sumResult2 = sum(val1, val2);
19 | console.log(`sum of ${val1} and ${val2} is ${sumResult2}`)
20 |
21 | //////////
22 |
23 | // reminder
24 | console.log(math.division.reminder(val1, val2));
25 | console.log(division.reminder(val1, val2));
26 | console.log(reminder(val1, val2));
27 |
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Sequence of Exposing/modules/math/division.js:
--------------------------------------------------------------------------------
1 | const division = (a, b) => a / b;
2 |
3 | const reminder = (a, b) => a % b;
4 |
5 | module.exports = {
6 | division,
7 | reminder
8 | }
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Sequence of Exposing/modules/math/index.js:
--------------------------------------------------------------------------------
1 | const divisionOps = require('./division')
2 |
3 | module.exports = {
4 | sum: require('./sum'), // function
5 | multiply: require('./multiply'), // function
6 | division: require('./division'), // object
7 | div: require('./division').division, // function from imported import
8 | reminder: divisionOps.reminder // function from imported import
9 | };
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Sequence of Exposing/modules/math/multiply.js:
--------------------------------------------------------------------------------
1 | const multiply = (a, b) => {
2 | return a * b;
3 | }
4 |
5 | module.exports = multiply;
--------------------------------------------------------------------------------
/04 - Local Modules/02 - Import Module/Tricks and Examples/Sequence of Exposing/modules/math/sum.js:
--------------------------------------------------------------------------------
1 | const sum = (a, b) => {
2 | return a + b;
3 | }
4 |
5 | module.exports = sum;
--------------------------------------------------------------------------------
/05 - Core Modules/01 - Built-in Global/01_builtin_globals.js:
--------------------------------------------------------------------------------
1 | /**
2 | * there are some modules/functions are not need to be imported, because it global (already imported)
3 | * built-in functions usually be globals
4 | */
5 |
6 | // example
7 | const absVal = Math.abs(-8);
8 |
9 | // example
10 | const apiResponse = fetch('some_url');
11 |
12 | // example
13 | console.log(global)
14 | global.car = 'delorean'
15 |
16 | // example
17 | console.log(process.env)
18 | console.log(process.argv)
19 | console.log(process.memoryUsage())
20 |
21 |
--------------------------------------------------------------------------------
/05 - Core Modules/02 - Event Emitter/02_event_listener.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 |
3 | const server = http.createServer();
4 |
5 | server.on('listening', () => {
6 | console.log('Server is listening now');
7 | })
8 |
9 | server.listen(3000)
--------------------------------------------------------------------------------
/05 - Core Modules/02 - Event Emitter/03_event_emitter.js:
--------------------------------------------------------------------------------
1 | const { EventEmitter } = require('events')
2 |
3 | const myEmitter = new EventEmitter();
4 |
5 | // listener
6 | myEmitter.on('greeting', () => {
7 | console.log('Hello to my app')
8 | })
9 |
10 | myEmitter.on('greeting', name => {
11 | console.log(`Hello ${name}`)
12 | })
13 |
14 | // emitter
15 | myEmitter.emit('greeting', 'Anas');
--------------------------------------------------------------------------------
/05 - Core Modules/03 - File System/04_readfile.js:
--------------------------------------------------------------------------------
1 | const { readFile, readFileSync } = require('fs')
2 |
3 | // async reading file
4 | readFile('./data/text.txt', 'utf8', (err, data) => {
5 | console.log('async', data)
6 | })
7 |
8 |
9 | // sync reading file
10 | const content = readFileSync('./data/text.txt', 'utf8')
11 | console.log('sync', content)
--------------------------------------------------------------------------------
/05 - Core Modules/03 - File System/05_opendir.js:
--------------------------------------------------------------------------------
1 | const { opendir } = require('fs')
2 |
3 | // opendir('./', (err, dir) => {
4 | // for (let dirent of dir) {
5 | // console.log(dirent.name)
6 | // }
7 | // })
8 |
9 | opendir('./', async (err, dir) => {
10 | for await (let dirent of dir) {
11 | console.log(dirent.name)
12 | }
13 | })
--------------------------------------------------------------------------------
/05 - Core Modules/03 - File System/06_stat.js:
--------------------------------------------------------------------------------
1 | const { stat } = require('fs')
2 |
3 | stat('./05_opendir.js', (err, state) => {
4 | console.log(state)
5 | })
--------------------------------------------------------------------------------
/05 - Core Modules/03 - File System/07_open.js:
--------------------------------------------------------------------------------
1 | const { open } = require('fs')
2 |
3 | open('./data/text.txt', (err, fd) => {
4 | if (err) {
5 | console.log(err)
6 | return;
7 | }
8 |
9 | readFile(fd, 'utf8', (err, content) => {
10 | if (err) {
11 | console.log(err)
12 | return;
13 | }
14 |
15 | console.log(content)
16 | })
17 | })
--------------------------------------------------------------------------------
/05 - Core Modules/03 - File System/08_writefile.js:
--------------------------------------------------------------------------------
1 | const { open, writeFile } = require('fs')
2 |
3 | open('./data/text.txt', (err, fd) => {
4 | if (err) {
5 | console.log(err)
6 | return;
7 | }
8 |
9 | writeFile(fd, 'Hello new writing', (err) => {
10 | if (err) {
11 | console.log(err)
12 | }
13 | })
14 | })
--------------------------------------------------------------------------------
/05 - Core Modules/03 - File System/data/text.txt:
--------------------------------------------------------------------------------
1 | hello
2 | text file data
3 | text text
--------------------------------------------------------------------------------
/05 - Core Modules/04 - Streams/09_read_write_pipe.js:
--------------------------------------------------------------------------------
1 | /**
2 | * types of streams:
3 | * read, write, duplex, transform
4 | */
5 |
6 |
7 | // an example for transform data from file to file
8 |
9 | const { createReadStream, createWriteStream } = require('fs')
10 |
11 | const readStream = createReadStream('./data/input.txt')
12 |
13 | const writeStream = createWriteStream('./data/output.txt')
14 |
15 | readStream.pipe(writeStream)
--------------------------------------------------------------------------------
/05 - Core Modules/04 - Streams/10_duplex.js:
--------------------------------------------------------------------------------
1 | // an example for socket between client and server
2 |
3 | const { createServer } = require('http')
4 |
5 | const server = createServer();
6 |
7 | server.listen(5000)
8 |
9 | server.on('connection', (socket) => {
10 | console.log(socket)
11 | })
--------------------------------------------------------------------------------
/05 - Core Modules/04 - Streams/data/input.txt:
--------------------------------------------------------------------------------
1 | data1 data2 data3 data4
--------------------------------------------------------------------------------
/05 - Core Modules/04 - Streams/data/output.txt:
--------------------------------------------------------------------------------
1 | data1 data2 data3 data4
--------------------------------------------------------------------------------
/05 - Core Modules/05 - Path/12_global_paths.js:
--------------------------------------------------------------------------------
1 | console.log(__dirname)
2 |
3 | console.log(__filename)
--------------------------------------------------------------------------------
/05 - Core Modules/05 - Path/13_cwd.js:
--------------------------------------------------------------------------------
1 | const mod = require('./my_modules/mod')
2 |
3 | console.log(process.cwd())
--------------------------------------------------------------------------------
/05 - Core Modules/05 - Path/14_path_module.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 |
3 | console.log(__filename)
4 |
5 | console.log(path.basename(__filename))
6 |
7 | console.log(path.extname(__filename))
8 |
9 | console.log(path.parse(__filename))
10 |
11 | //////////////////////
12 |
13 | const {readFile} = require('fs');
14 |
15 | readFile(path.join(__dirname, 'data', 'text.txt'), 'utf8', (err, data) => {
16 | console.log(data)
17 | })
--------------------------------------------------------------------------------
/05 - Core Modules/05 - Path/data/text.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MohammedElagha/IUG-Nodejs-Course/29d24624706913b4e439000e6657fb8d6d1ad296/05 - Core Modules/05 - Path/data/text.txt
--------------------------------------------------------------------------------
/05 - Core Modules/05 - Path/my_modules/11_relative_path.js:
--------------------------------------------------------------------------------
1 | // this relative path is relative to 11_relative_path.js file
2 | const story = require('./data/story.txt')
3 | console.log(story)
4 |
5 |
6 | ///////////////
7 |
8 |
9 | const { readFile } = require('fs')
10 |
11 | // this relative path is relative to when run "node"
12 | readFile('./data/story.txt', 'utf8', (err, data) => {
13 | console.log(err)
14 | console.log(data)
15 | })
--------------------------------------------------------------------------------
/05 - Core Modules/05 - Path/my_modules/mod.js:
--------------------------------------------------------------------------------
1 | console.log(__filename)
2 |
3 | console.log(process.cwd())
--------------------------------------------------------------------------------
/06 - NPM/Project 1/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Project 1",
3 | "lockfileVersion": 3,
4 | "requires": true,
5 | "packages": {
6 | "": {
7 | "dependencies": {
8 | "express": "^4.18.2"
9 | }
10 | },
11 | "node_modules/accepts": {
12 | "version": "1.3.8",
13 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
14 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
15 | "dependencies": {
16 | "mime-types": "~2.1.34",
17 | "negotiator": "0.6.3"
18 | },
19 | "engines": {
20 | "node": ">= 0.6"
21 | }
22 | },
23 | "node_modules/array-flatten": {
24 | "version": "1.1.1",
25 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
26 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
27 | },
28 | "node_modules/body-parser": {
29 | "version": "1.20.1",
30 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
31 | "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
32 | "dependencies": {
33 | "bytes": "3.1.2",
34 | "content-type": "~1.0.4",
35 | "debug": "2.6.9",
36 | "depd": "2.0.0",
37 | "destroy": "1.2.0",
38 | "http-errors": "2.0.0",
39 | "iconv-lite": "0.4.24",
40 | "on-finished": "2.4.1",
41 | "qs": "6.11.0",
42 | "raw-body": "2.5.1",
43 | "type-is": "~1.6.18",
44 | "unpipe": "1.0.0"
45 | },
46 | "engines": {
47 | "node": ">= 0.8",
48 | "npm": "1.2.8000 || >= 1.4.16"
49 | }
50 | },
51 | "node_modules/bytes": {
52 | "version": "3.1.2",
53 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
54 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
55 | "engines": {
56 | "node": ">= 0.8"
57 | }
58 | },
59 | "node_modules/call-bind": {
60 | "version": "1.0.2",
61 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
62 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
63 | "dependencies": {
64 | "function-bind": "^1.1.1",
65 | "get-intrinsic": "^1.0.2"
66 | },
67 | "funding": {
68 | "url": "https://github.com/sponsors/ljharb"
69 | }
70 | },
71 | "node_modules/content-disposition": {
72 | "version": "0.5.4",
73 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
74 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
75 | "dependencies": {
76 | "safe-buffer": "5.2.1"
77 | },
78 | "engines": {
79 | "node": ">= 0.6"
80 | }
81 | },
82 | "node_modules/content-type": {
83 | "version": "1.0.5",
84 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
85 | "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
86 | "engines": {
87 | "node": ">= 0.6"
88 | }
89 | },
90 | "node_modules/cookie": {
91 | "version": "0.5.0",
92 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
93 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
94 | "engines": {
95 | "node": ">= 0.6"
96 | }
97 | },
98 | "node_modules/cookie-signature": {
99 | "version": "1.0.6",
100 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
101 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
102 | },
103 | "node_modules/debug": {
104 | "version": "2.6.9",
105 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
106 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
107 | "dependencies": {
108 | "ms": "2.0.0"
109 | }
110 | },
111 | "node_modules/depd": {
112 | "version": "2.0.0",
113 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
114 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
115 | "engines": {
116 | "node": ">= 0.8"
117 | }
118 | },
119 | "node_modules/destroy": {
120 | "version": "1.2.0",
121 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
122 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
123 | "engines": {
124 | "node": ">= 0.8",
125 | "npm": "1.2.8000 || >= 1.4.16"
126 | }
127 | },
128 | "node_modules/ee-first": {
129 | "version": "1.1.1",
130 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
131 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
132 | },
133 | "node_modules/encodeurl": {
134 | "version": "1.0.2",
135 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
136 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
137 | "engines": {
138 | "node": ">= 0.8"
139 | }
140 | },
141 | "node_modules/escape-html": {
142 | "version": "1.0.3",
143 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
144 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
145 | },
146 | "node_modules/etag": {
147 | "version": "1.8.1",
148 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
149 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
150 | "engines": {
151 | "node": ">= 0.6"
152 | }
153 | },
154 | "node_modules/express": {
155 | "version": "4.18.2",
156 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
157 | "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
158 | "dependencies": {
159 | "accepts": "~1.3.8",
160 | "array-flatten": "1.1.1",
161 | "body-parser": "1.20.1",
162 | "content-disposition": "0.5.4",
163 | "content-type": "~1.0.4",
164 | "cookie": "0.5.0",
165 | "cookie-signature": "1.0.6",
166 | "debug": "2.6.9",
167 | "depd": "2.0.0",
168 | "encodeurl": "~1.0.2",
169 | "escape-html": "~1.0.3",
170 | "etag": "~1.8.1",
171 | "finalhandler": "1.2.0",
172 | "fresh": "0.5.2",
173 | "http-errors": "2.0.0",
174 | "merge-descriptors": "1.0.1",
175 | "methods": "~1.1.2",
176 | "on-finished": "2.4.1",
177 | "parseurl": "~1.3.3",
178 | "path-to-regexp": "0.1.7",
179 | "proxy-addr": "~2.0.7",
180 | "qs": "6.11.0",
181 | "range-parser": "~1.2.1",
182 | "safe-buffer": "5.2.1",
183 | "send": "0.18.0",
184 | "serve-static": "1.15.0",
185 | "setprototypeof": "1.2.0",
186 | "statuses": "2.0.1",
187 | "type-is": "~1.6.18",
188 | "utils-merge": "1.0.1",
189 | "vary": "~1.1.2"
190 | },
191 | "engines": {
192 | "node": ">= 0.10.0"
193 | }
194 | },
195 | "node_modules/finalhandler": {
196 | "version": "1.2.0",
197 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
198 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
199 | "dependencies": {
200 | "debug": "2.6.9",
201 | "encodeurl": "~1.0.2",
202 | "escape-html": "~1.0.3",
203 | "on-finished": "2.4.1",
204 | "parseurl": "~1.3.3",
205 | "statuses": "2.0.1",
206 | "unpipe": "~1.0.0"
207 | },
208 | "engines": {
209 | "node": ">= 0.8"
210 | }
211 | },
212 | "node_modules/forwarded": {
213 | "version": "0.2.0",
214 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
215 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
216 | "engines": {
217 | "node": ">= 0.6"
218 | }
219 | },
220 | "node_modules/fresh": {
221 | "version": "0.5.2",
222 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
223 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
224 | "engines": {
225 | "node": ">= 0.6"
226 | }
227 | },
228 | "node_modules/function-bind": {
229 | "version": "1.1.1",
230 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
231 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
232 | },
233 | "node_modules/get-intrinsic": {
234 | "version": "1.2.0",
235 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
236 | "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
237 | "dependencies": {
238 | "function-bind": "^1.1.1",
239 | "has": "^1.0.3",
240 | "has-symbols": "^1.0.3"
241 | },
242 | "funding": {
243 | "url": "https://github.com/sponsors/ljharb"
244 | }
245 | },
246 | "node_modules/has": {
247 | "version": "1.0.3",
248 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
249 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
250 | "dependencies": {
251 | "function-bind": "^1.1.1"
252 | },
253 | "engines": {
254 | "node": ">= 0.4.0"
255 | }
256 | },
257 | "node_modules/has-symbols": {
258 | "version": "1.0.3",
259 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
260 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
261 | "engines": {
262 | "node": ">= 0.4"
263 | },
264 | "funding": {
265 | "url": "https://github.com/sponsors/ljharb"
266 | }
267 | },
268 | "node_modules/http-errors": {
269 | "version": "2.0.0",
270 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
271 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
272 | "dependencies": {
273 | "depd": "2.0.0",
274 | "inherits": "2.0.4",
275 | "setprototypeof": "1.2.0",
276 | "statuses": "2.0.1",
277 | "toidentifier": "1.0.1"
278 | },
279 | "engines": {
280 | "node": ">= 0.8"
281 | }
282 | },
283 | "node_modules/iconv-lite": {
284 | "version": "0.4.24",
285 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
286 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
287 | "dependencies": {
288 | "safer-buffer": ">= 2.1.2 < 3"
289 | },
290 | "engines": {
291 | "node": ">=0.10.0"
292 | }
293 | },
294 | "node_modules/inherits": {
295 | "version": "2.0.4",
296 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
297 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
298 | },
299 | "node_modules/ipaddr.js": {
300 | "version": "1.9.1",
301 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
302 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
303 | "engines": {
304 | "node": ">= 0.10"
305 | }
306 | },
307 | "node_modules/media-typer": {
308 | "version": "0.3.0",
309 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
310 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
311 | "engines": {
312 | "node": ">= 0.6"
313 | }
314 | },
315 | "node_modules/merge-descriptors": {
316 | "version": "1.0.1",
317 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
318 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
319 | },
320 | "node_modules/methods": {
321 | "version": "1.1.2",
322 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
323 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
324 | "engines": {
325 | "node": ">= 0.6"
326 | }
327 | },
328 | "node_modules/mime": {
329 | "version": "1.6.0",
330 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
331 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
332 | "bin": {
333 | "mime": "cli.js"
334 | },
335 | "engines": {
336 | "node": ">=4"
337 | }
338 | },
339 | "node_modules/mime-db": {
340 | "version": "1.52.0",
341 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
342 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
343 | "engines": {
344 | "node": ">= 0.6"
345 | }
346 | },
347 | "node_modules/mime-types": {
348 | "version": "2.1.35",
349 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
350 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
351 | "dependencies": {
352 | "mime-db": "1.52.0"
353 | },
354 | "engines": {
355 | "node": ">= 0.6"
356 | }
357 | },
358 | "node_modules/ms": {
359 | "version": "2.0.0",
360 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
361 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
362 | },
363 | "node_modules/negotiator": {
364 | "version": "0.6.3",
365 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
366 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
367 | "engines": {
368 | "node": ">= 0.6"
369 | }
370 | },
371 | "node_modules/object-inspect": {
372 | "version": "1.12.3",
373 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
374 | "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
375 | "funding": {
376 | "url": "https://github.com/sponsors/ljharb"
377 | }
378 | },
379 | "node_modules/on-finished": {
380 | "version": "2.4.1",
381 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
382 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
383 | "dependencies": {
384 | "ee-first": "1.1.1"
385 | },
386 | "engines": {
387 | "node": ">= 0.8"
388 | }
389 | },
390 | "node_modules/parseurl": {
391 | "version": "1.3.3",
392 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
393 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
394 | "engines": {
395 | "node": ">= 0.8"
396 | }
397 | },
398 | "node_modules/path-to-regexp": {
399 | "version": "0.1.7",
400 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
401 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
402 | },
403 | "node_modules/proxy-addr": {
404 | "version": "2.0.7",
405 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
406 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
407 | "dependencies": {
408 | "forwarded": "0.2.0",
409 | "ipaddr.js": "1.9.1"
410 | },
411 | "engines": {
412 | "node": ">= 0.10"
413 | }
414 | },
415 | "node_modules/qs": {
416 | "version": "6.11.0",
417 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
418 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
419 | "dependencies": {
420 | "side-channel": "^1.0.4"
421 | },
422 | "engines": {
423 | "node": ">=0.6"
424 | },
425 | "funding": {
426 | "url": "https://github.com/sponsors/ljharb"
427 | }
428 | },
429 | "node_modules/range-parser": {
430 | "version": "1.2.1",
431 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
432 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
433 | "engines": {
434 | "node": ">= 0.6"
435 | }
436 | },
437 | "node_modules/raw-body": {
438 | "version": "2.5.1",
439 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
440 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
441 | "dependencies": {
442 | "bytes": "3.1.2",
443 | "http-errors": "2.0.0",
444 | "iconv-lite": "0.4.24",
445 | "unpipe": "1.0.0"
446 | },
447 | "engines": {
448 | "node": ">= 0.8"
449 | }
450 | },
451 | "node_modules/safe-buffer": {
452 | "version": "5.2.1",
453 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
454 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
455 | "funding": [
456 | {
457 | "type": "github",
458 | "url": "https://github.com/sponsors/feross"
459 | },
460 | {
461 | "type": "patreon",
462 | "url": "https://www.patreon.com/feross"
463 | },
464 | {
465 | "type": "consulting",
466 | "url": "https://feross.org/support"
467 | }
468 | ]
469 | },
470 | "node_modules/safer-buffer": {
471 | "version": "2.1.2",
472 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
473 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
474 | },
475 | "node_modules/send": {
476 | "version": "0.18.0",
477 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
478 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
479 | "dependencies": {
480 | "debug": "2.6.9",
481 | "depd": "2.0.0",
482 | "destroy": "1.2.0",
483 | "encodeurl": "~1.0.2",
484 | "escape-html": "~1.0.3",
485 | "etag": "~1.8.1",
486 | "fresh": "0.5.2",
487 | "http-errors": "2.0.0",
488 | "mime": "1.6.0",
489 | "ms": "2.1.3",
490 | "on-finished": "2.4.1",
491 | "range-parser": "~1.2.1",
492 | "statuses": "2.0.1"
493 | },
494 | "engines": {
495 | "node": ">= 0.8.0"
496 | }
497 | },
498 | "node_modules/send/node_modules/ms": {
499 | "version": "2.1.3",
500 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
501 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
502 | },
503 | "node_modules/serve-static": {
504 | "version": "1.15.0",
505 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
506 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
507 | "dependencies": {
508 | "encodeurl": "~1.0.2",
509 | "escape-html": "~1.0.3",
510 | "parseurl": "~1.3.3",
511 | "send": "0.18.0"
512 | },
513 | "engines": {
514 | "node": ">= 0.8.0"
515 | }
516 | },
517 | "node_modules/setprototypeof": {
518 | "version": "1.2.0",
519 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
520 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
521 | },
522 | "node_modules/side-channel": {
523 | "version": "1.0.4",
524 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
525 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
526 | "dependencies": {
527 | "call-bind": "^1.0.0",
528 | "get-intrinsic": "^1.0.2",
529 | "object-inspect": "^1.9.0"
530 | },
531 | "funding": {
532 | "url": "https://github.com/sponsors/ljharb"
533 | }
534 | },
535 | "node_modules/statuses": {
536 | "version": "2.0.1",
537 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
538 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
539 | "engines": {
540 | "node": ">= 0.8"
541 | }
542 | },
543 | "node_modules/toidentifier": {
544 | "version": "1.0.1",
545 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
546 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
547 | "engines": {
548 | "node": ">=0.6"
549 | }
550 | },
551 | "node_modules/type-is": {
552 | "version": "1.6.18",
553 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
554 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
555 | "dependencies": {
556 | "media-typer": "0.3.0",
557 | "mime-types": "~2.1.24"
558 | },
559 | "engines": {
560 | "node": ">= 0.6"
561 | }
562 | },
563 | "node_modules/unpipe": {
564 | "version": "1.0.0",
565 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
566 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
567 | "engines": {
568 | "node": ">= 0.8"
569 | }
570 | },
571 | "node_modules/utils-merge": {
572 | "version": "1.0.1",
573 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
574 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
575 | "engines": {
576 | "node": ">= 0.4.0"
577 | }
578 | },
579 | "node_modules/vary": {
580 | "version": "1.1.2",
581 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
582 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
583 | "engines": {
584 | "node": ">= 0.8"
585 | }
586 | }
587 | }
588 | }
589 |
--------------------------------------------------------------------------------
/06 - NPM/Project 1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "express": "^4.18.2"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/06 - NPM/Project 2/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "project-2",
3 | "version": "1.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "project-2",
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.0",
239 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
240 | "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
241 | "dependencies": {
242 | "function-bind": "^1.1.1",
243 | "has": "^1.0.3",
244 | "has-symbols": "^1.0.3"
245 | },
246 | "funding": {
247 | "url": "https://github.com/sponsors/ljharb"
248 | }
249 | },
250 | "node_modules/has": {
251 | "version": "1.0.3",
252 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
253 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
254 | "dependencies": {
255 | "function-bind": "^1.1.1"
256 | },
257 | "engines": {
258 | "node": ">= 0.4.0"
259 | }
260 | },
261 | "node_modules/has-symbols": {
262 | "version": "1.0.3",
263 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
264 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
265 | "engines": {
266 | "node": ">= 0.4"
267 | },
268 | "funding": {
269 | "url": "https://github.com/sponsors/ljharb"
270 | }
271 | },
272 | "node_modules/http-errors": {
273 | "version": "2.0.0",
274 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
275 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
276 | "dependencies": {
277 | "depd": "2.0.0",
278 | "inherits": "2.0.4",
279 | "setprototypeof": "1.2.0",
280 | "statuses": "2.0.1",
281 | "toidentifier": "1.0.1"
282 | },
283 | "engines": {
284 | "node": ">= 0.8"
285 | }
286 | },
287 | "node_modules/iconv-lite": {
288 | "version": "0.4.24",
289 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
290 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
291 | "dependencies": {
292 | "safer-buffer": ">= 2.1.2 < 3"
293 | },
294 | "engines": {
295 | "node": ">=0.10.0"
296 | }
297 | },
298 | "node_modules/inherits": {
299 | "version": "2.0.4",
300 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
301 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
302 | },
303 | "node_modules/ipaddr.js": {
304 | "version": "1.9.1",
305 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
306 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
307 | "engines": {
308 | "node": ">= 0.10"
309 | }
310 | },
311 | "node_modules/media-typer": {
312 | "version": "0.3.0",
313 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
314 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
315 | "engines": {
316 | "node": ">= 0.6"
317 | }
318 | },
319 | "node_modules/merge-descriptors": {
320 | "version": "1.0.1",
321 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
322 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
323 | },
324 | "node_modules/methods": {
325 | "version": "1.1.2",
326 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
327 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
328 | "engines": {
329 | "node": ">= 0.6"
330 | }
331 | },
332 | "node_modules/mime": {
333 | "version": "1.6.0",
334 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
335 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
336 | "bin": {
337 | "mime": "cli.js"
338 | },
339 | "engines": {
340 | "node": ">=4"
341 | }
342 | },
343 | "node_modules/mime-db": {
344 | "version": "1.52.0",
345 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
346 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
347 | "engines": {
348 | "node": ">= 0.6"
349 | }
350 | },
351 | "node_modules/mime-types": {
352 | "version": "2.1.35",
353 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
354 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
355 | "dependencies": {
356 | "mime-db": "1.52.0"
357 | },
358 | "engines": {
359 | "node": ">= 0.6"
360 | }
361 | },
362 | "node_modules/ms": {
363 | "version": "2.0.0",
364 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
365 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
366 | },
367 | "node_modules/negotiator": {
368 | "version": "0.6.3",
369 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
370 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
371 | "engines": {
372 | "node": ">= 0.6"
373 | }
374 | },
375 | "node_modules/object-inspect": {
376 | "version": "1.12.3",
377 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
378 | "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
379 | "funding": {
380 | "url": "https://github.com/sponsors/ljharb"
381 | }
382 | },
383 | "node_modules/on-finished": {
384 | "version": "2.4.1",
385 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
386 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
387 | "dependencies": {
388 | "ee-first": "1.1.1"
389 | },
390 | "engines": {
391 | "node": ">= 0.8"
392 | }
393 | },
394 | "node_modules/parseurl": {
395 | "version": "1.3.3",
396 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
397 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
398 | "engines": {
399 | "node": ">= 0.8"
400 | }
401 | },
402 | "node_modules/path-to-regexp": {
403 | "version": "0.1.7",
404 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
405 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
406 | },
407 | "node_modules/proxy-addr": {
408 | "version": "2.0.7",
409 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
410 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
411 | "dependencies": {
412 | "forwarded": "0.2.0",
413 | "ipaddr.js": "1.9.1"
414 | },
415 | "engines": {
416 | "node": ">= 0.10"
417 | }
418 | },
419 | "node_modules/qs": {
420 | "version": "6.11.0",
421 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
422 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
423 | "dependencies": {
424 | "side-channel": "^1.0.4"
425 | },
426 | "engines": {
427 | "node": ">=0.6"
428 | },
429 | "funding": {
430 | "url": "https://github.com/sponsors/ljharb"
431 | }
432 | },
433 | "node_modules/range-parser": {
434 | "version": "1.2.1",
435 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
436 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
437 | "engines": {
438 | "node": ">= 0.6"
439 | }
440 | },
441 | "node_modules/raw-body": {
442 | "version": "2.5.1",
443 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
444 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
445 | "dependencies": {
446 | "bytes": "3.1.2",
447 | "http-errors": "2.0.0",
448 | "iconv-lite": "0.4.24",
449 | "unpipe": "1.0.0"
450 | },
451 | "engines": {
452 | "node": ">= 0.8"
453 | }
454 | },
455 | "node_modules/safe-buffer": {
456 | "version": "5.2.1",
457 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
458 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
459 | "funding": [
460 | {
461 | "type": "github",
462 | "url": "https://github.com/sponsors/feross"
463 | },
464 | {
465 | "type": "patreon",
466 | "url": "https://www.patreon.com/feross"
467 | },
468 | {
469 | "type": "consulting",
470 | "url": "https://feross.org/support"
471 | }
472 | ]
473 | },
474 | "node_modules/safer-buffer": {
475 | "version": "2.1.2",
476 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
477 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
478 | },
479 | "node_modules/send": {
480 | "version": "0.18.0",
481 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
482 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
483 | "dependencies": {
484 | "debug": "2.6.9",
485 | "depd": "2.0.0",
486 | "destroy": "1.2.0",
487 | "encodeurl": "~1.0.2",
488 | "escape-html": "~1.0.3",
489 | "etag": "~1.8.1",
490 | "fresh": "0.5.2",
491 | "http-errors": "2.0.0",
492 | "mime": "1.6.0",
493 | "ms": "2.1.3",
494 | "on-finished": "2.4.1",
495 | "range-parser": "~1.2.1",
496 | "statuses": "2.0.1"
497 | },
498 | "engines": {
499 | "node": ">= 0.8.0"
500 | }
501 | },
502 | "node_modules/send/node_modules/ms": {
503 | "version": "2.1.3",
504 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
505 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
506 | },
507 | "node_modules/serve-static": {
508 | "version": "1.15.0",
509 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
510 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
511 | "dependencies": {
512 | "encodeurl": "~1.0.2",
513 | "escape-html": "~1.0.3",
514 | "parseurl": "~1.3.3",
515 | "send": "0.18.0"
516 | },
517 | "engines": {
518 | "node": ">= 0.8.0"
519 | }
520 | },
521 | "node_modules/setprototypeof": {
522 | "version": "1.2.0",
523 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
524 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
525 | },
526 | "node_modules/side-channel": {
527 | "version": "1.0.4",
528 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
529 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
530 | "dependencies": {
531 | "call-bind": "^1.0.0",
532 | "get-intrinsic": "^1.0.2",
533 | "object-inspect": "^1.9.0"
534 | },
535 | "funding": {
536 | "url": "https://github.com/sponsors/ljharb"
537 | }
538 | },
539 | "node_modules/statuses": {
540 | "version": "2.0.1",
541 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
542 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
543 | "engines": {
544 | "node": ">= 0.8"
545 | }
546 | },
547 | "node_modules/toidentifier": {
548 | "version": "1.0.1",
549 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
550 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
551 | "engines": {
552 | "node": ">=0.6"
553 | }
554 | },
555 | "node_modules/type-is": {
556 | "version": "1.6.18",
557 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
558 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
559 | "dependencies": {
560 | "media-typer": "0.3.0",
561 | "mime-types": "~2.1.24"
562 | },
563 | "engines": {
564 | "node": ">= 0.6"
565 | }
566 | },
567 | "node_modules/unpipe": {
568 | "version": "1.0.0",
569 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
570 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
571 | "engines": {
572 | "node": ">= 0.8"
573 | }
574 | },
575 | "node_modules/utils-merge": {
576 | "version": "1.0.1",
577 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
578 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
579 | "engines": {
580 | "node": ">= 0.4.0"
581 | }
582 | },
583 | "node_modules/vary": {
584 | "version": "1.1.2",
585 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
586 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
587 | "engines": {
588 | "node": ">= 0.8"
589 | }
590 | }
591 | }
592 | }
593 |
--------------------------------------------------------------------------------
/06 - NPM/Project 2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "project-2",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/06 - NPM/npm_commands.txt:
--------------------------------------------------------------------------------
1 | # initiate npm
2 | npm init
3 |
4 | # install a package on production
5 | npm install package_name
6 | npm i package_name
7 | npm install --save package_name
8 | npm i --save package_name
9 |
10 | # install a package on dev
11 | npm install --save-dev package_name
12 | npm i --save-dev package_name
13 |
14 | # list all npm packages (installed and installed dependencies)
15 | npm list
16 | npm list --depth=some_number
17 |
18 | # show details of a installed package
19 | npm view package_name
20 |
21 | # install a package with a version
22 | npm i package_name@1.1.1
23 |
24 | # list out-of-date package (npm check updates)
25 | ncu
26 |
27 | # upgrade packages version (without installation)
28 | ncu -u
29 |
30 | # install/update all packages in package.json
31 | npm install
32 |
33 | # uninstall package
34 | npm uninstall package_name
35 | npm un package_name
36 |
37 | # install a package globally
38 | npm i -g package_name
--------------------------------------------------------------------------------
/07 - Web/01 - Standard Communication Languages/grades.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Grades
6 |
7 |
8 |
9 |
10 |
11 | Course Name |
12 | Course Teacher |
13 | Grade |
14 |
15 |
16 |
17 |
18 |
19 | Java |
20 | Mohammed |
21 | 88 |
22 |
23 |
24 | Web |
25 | Mohammed |
26 | 70 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/07 - Web/01 - Standard Communication Languages/grades.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "course_name": "Java",
4 | "teacher_name": "Mohammed",
5 | "grade": 88
6 | },
7 | {
8 | "course_name": "Web",
9 | "teacher_name": "Mohammed",
10 | "grade": 70
11 | }
12 | ]
--------------------------------------------------------------------------------
/07 - Web/01 - Standard Communication Languages/grades.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Java
6 | Mohammed
7 | 88
8 |
9 |
10 | Web
11 | Mohammed
12 | 70
13 |
14 |
--------------------------------------------------------------------------------
/08 - API/API Project 01/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 |
3 | const app = express();
4 |
5 |
6 | /**
7 | * Middlewares
8 | */
9 | app.use((req, res, next) => {
10 | console.log(req.ip);
11 | next();
12 | })
13 |
14 |
15 | /**
16 | * Routes
17 | */
18 |
19 | // route
20 | app.get('/', (req, res, next) => {
21 | // res.status(200).send('Welcome to the home page')
22 |
23 | res.status(200).json({
24 | message: "Welcome to the home"
25 | });
26 | })
27 |
28 | // redirect
29 | app.get('/home', (req, res, next) => {
30 | res.redirect('/')
31 | })
32 |
33 | // path param
34 | app.get('/user/:id', (req, res, next) => {
35 | console.log(req.params);
36 | res.send("Welcome to user page")
37 | })
38 |
39 | // path, get, header
40 | app.get('/user/:id/post/:postId', (req, res, next) => {
41 | console.log(req.params);
42 | console.log(req.query);
43 | console.log(req.query.timezone);
44 | console.log(req.get('Host'))
45 | res.send("Welcome to post page")
46 | })
47 |
48 | module.exports = app
--------------------------------------------------------------------------------
/08 - API/API Project 01/index.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 | const app = require('./app')
3 |
4 | const server = http.createServer(app)
5 |
6 | server.listen(5000, () => {
7 | console.log('Server is listening now')
8 | })
--------------------------------------------------------------------------------
/08 - API/API Project 01/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-project-01",
3 | "version": "1.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "api-project-01",
9 | "version": "1.0.0",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2"
13 | },
14 | "devDependencies": {
15 | "nodemon": "^2.0.22"
16 | }
17 | },
18 | "node_modules/abbrev": {
19 | "version": "1.1.1",
20 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
21 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
22 | "dev": true
23 | },
24 | "node_modules/accepts": {
25 | "version": "1.3.8",
26 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
27 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
28 | "dependencies": {
29 | "mime-types": "~2.1.34",
30 | "negotiator": "0.6.3"
31 | },
32 | "engines": {
33 | "node": ">= 0.6"
34 | }
35 | },
36 | "node_modules/anymatch": {
37 | "version": "3.1.3",
38 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
39 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
40 | "dev": true,
41 | "dependencies": {
42 | "normalize-path": "^3.0.0",
43 | "picomatch": "^2.0.4"
44 | },
45 | "engines": {
46 | "node": ">= 8"
47 | }
48 | },
49 | "node_modules/array-flatten": {
50 | "version": "1.1.1",
51 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
52 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
53 | },
54 | "node_modules/balanced-match": {
55 | "version": "1.0.2",
56 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
57 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
58 | "dev": true
59 | },
60 | "node_modules/binary-extensions": {
61 | "version": "2.2.0",
62 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
63 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
64 | "dev": true,
65 | "engines": {
66 | "node": ">=8"
67 | }
68 | },
69 | "node_modules/body-parser": {
70 | "version": "1.20.1",
71 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
72 | "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
73 | "dependencies": {
74 | "bytes": "3.1.2",
75 | "content-type": "~1.0.4",
76 | "debug": "2.6.9",
77 | "depd": "2.0.0",
78 | "destroy": "1.2.0",
79 | "http-errors": "2.0.0",
80 | "iconv-lite": "0.4.24",
81 | "on-finished": "2.4.1",
82 | "qs": "6.11.0",
83 | "raw-body": "2.5.1",
84 | "type-is": "~1.6.18",
85 | "unpipe": "1.0.0"
86 | },
87 | "engines": {
88 | "node": ">= 0.8",
89 | "npm": "1.2.8000 || >= 1.4.16"
90 | }
91 | },
92 | "node_modules/brace-expansion": {
93 | "version": "1.1.11",
94 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
95 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
96 | "dev": true,
97 | "dependencies": {
98 | "balanced-match": "^1.0.0",
99 | "concat-map": "0.0.1"
100 | }
101 | },
102 | "node_modules/braces": {
103 | "version": "3.0.2",
104 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
105 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
106 | "dev": true,
107 | "dependencies": {
108 | "fill-range": "^7.0.1"
109 | },
110 | "engines": {
111 | "node": ">=8"
112 | }
113 | },
114 | "node_modules/bytes": {
115 | "version": "3.1.2",
116 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
117 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
118 | "engines": {
119 | "node": ">= 0.8"
120 | }
121 | },
122 | "node_modules/call-bind": {
123 | "version": "1.0.2",
124 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
125 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
126 | "dependencies": {
127 | "function-bind": "^1.1.1",
128 | "get-intrinsic": "^1.0.2"
129 | },
130 | "funding": {
131 | "url": "https://github.com/sponsors/ljharb"
132 | }
133 | },
134 | "node_modules/chokidar": {
135 | "version": "3.5.3",
136 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
137 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
138 | "dev": true,
139 | "funding": [
140 | {
141 | "type": "individual",
142 | "url": "https://paulmillr.com/funding/"
143 | }
144 | ],
145 | "dependencies": {
146 | "anymatch": "~3.1.2",
147 | "braces": "~3.0.2",
148 | "glob-parent": "~5.1.2",
149 | "is-binary-path": "~2.1.0",
150 | "is-glob": "~4.0.1",
151 | "normalize-path": "~3.0.0",
152 | "readdirp": "~3.6.0"
153 | },
154 | "engines": {
155 | "node": ">= 8.10.0"
156 | },
157 | "optionalDependencies": {
158 | "fsevents": "~2.3.2"
159 | }
160 | },
161 | "node_modules/concat-map": {
162 | "version": "0.0.1",
163 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
164 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
165 | "dev": true
166 | },
167 | "node_modules/content-disposition": {
168 | "version": "0.5.4",
169 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
170 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
171 | "dependencies": {
172 | "safe-buffer": "5.2.1"
173 | },
174 | "engines": {
175 | "node": ">= 0.6"
176 | }
177 | },
178 | "node_modules/content-type": {
179 | "version": "1.0.5",
180 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
181 | "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
182 | "engines": {
183 | "node": ">= 0.6"
184 | }
185 | },
186 | "node_modules/cookie": {
187 | "version": "0.5.0",
188 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
189 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
190 | "engines": {
191 | "node": ">= 0.6"
192 | }
193 | },
194 | "node_modules/cookie-signature": {
195 | "version": "1.0.6",
196 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
197 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
198 | },
199 | "node_modules/debug": {
200 | "version": "2.6.9",
201 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
202 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
203 | "dependencies": {
204 | "ms": "2.0.0"
205 | }
206 | },
207 | "node_modules/depd": {
208 | "version": "2.0.0",
209 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
210 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
211 | "engines": {
212 | "node": ">= 0.8"
213 | }
214 | },
215 | "node_modules/destroy": {
216 | "version": "1.2.0",
217 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
218 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
219 | "engines": {
220 | "node": ">= 0.8",
221 | "npm": "1.2.8000 || >= 1.4.16"
222 | }
223 | },
224 | "node_modules/ee-first": {
225 | "version": "1.1.1",
226 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
227 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
228 | },
229 | "node_modules/encodeurl": {
230 | "version": "1.0.2",
231 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
232 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
233 | "engines": {
234 | "node": ">= 0.8"
235 | }
236 | },
237 | "node_modules/escape-html": {
238 | "version": "1.0.3",
239 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
240 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
241 | },
242 | "node_modules/etag": {
243 | "version": "1.8.1",
244 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
245 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
246 | "engines": {
247 | "node": ">= 0.6"
248 | }
249 | },
250 | "node_modules/express": {
251 | "version": "4.18.2",
252 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
253 | "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
254 | "dependencies": {
255 | "accepts": "~1.3.8",
256 | "array-flatten": "1.1.1",
257 | "body-parser": "1.20.1",
258 | "content-disposition": "0.5.4",
259 | "content-type": "~1.0.4",
260 | "cookie": "0.5.0",
261 | "cookie-signature": "1.0.6",
262 | "debug": "2.6.9",
263 | "depd": "2.0.0",
264 | "encodeurl": "~1.0.2",
265 | "escape-html": "~1.0.3",
266 | "etag": "~1.8.1",
267 | "finalhandler": "1.2.0",
268 | "fresh": "0.5.2",
269 | "http-errors": "2.0.0",
270 | "merge-descriptors": "1.0.1",
271 | "methods": "~1.1.2",
272 | "on-finished": "2.4.1",
273 | "parseurl": "~1.3.3",
274 | "path-to-regexp": "0.1.7",
275 | "proxy-addr": "~2.0.7",
276 | "qs": "6.11.0",
277 | "range-parser": "~1.2.1",
278 | "safe-buffer": "5.2.1",
279 | "send": "0.18.0",
280 | "serve-static": "1.15.0",
281 | "setprototypeof": "1.2.0",
282 | "statuses": "2.0.1",
283 | "type-is": "~1.6.18",
284 | "utils-merge": "1.0.1",
285 | "vary": "~1.1.2"
286 | },
287 | "engines": {
288 | "node": ">= 0.10.0"
289 | }
290 | },
291 | "node_modules/fill-range": {
292 | "version": "7.0.1",
293 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
294 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
295 | "dev": true,
296 | "dependencies": {
297 | "to-regex-range": "^5.0.1"
298 | },
299 | "engines": {
300 | "node": ">=8"
301 | }
302 | },
303 | "node_modules/finalhandler": {
304 | "version": "1.2.0",
305 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
306 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
307 | "dependencies": {
308 | "debug": "2.6.9",
309 | "encodeurl": "~1.0.2",
310 | "escape-html": "~1.0.3",
311 | "on-finished": "2.4.1",
312 | "parseurl": "~1.3.3",
313 | "statuses": "2.0.1",
314 | "unpipe": "~1.0.0"
315 | },
316 | "engines": {
317 | "node": ">= 0.8"
318 | }
319 | },
320 | "node_modules/forwarded": {
321 | "version": "0.2.0",
322 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
323 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
324 | "engines": {
325 | "node": ">= 0.6"
326 | }
327 | },
328 | "node_modules/fresh": {
329 | "version": "0.5.2",
330 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
331 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
332 | "engines": {
333 | "node": ">= 0.6"
334 | }
335 | },
336 | "node_modules/fsevents": {
337 | "version": "2.3.2",
338 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
339 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
340 | "dev": true,
341 | "hasInstallScript": true,
342 | "optional": true,
343 | "os": [
344 | "darwin"
345 | ],
346 | "engines": {
347 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
348 | }
349 | },
350 | "node_modules/function-bind": {
351 | "version": "1.1.1",
352 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
353 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
354 | },
355 | "node_modules/get-intrinsic": {
356 | "version": "1.2.0",
357 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
358 | "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
359 | "dependencies": {
360 | "function-bind": "^1.1.1",
361 | "has": "^1.0.3",
362 | "has-symbols": "^1.0.3"
363 | },
364 | "funding": {
365 | "url": "https://github.com/sponsors/ljharb"
366 | }
367 | },
368 | "node_modules/glob-parent": {
369 | "version": "5.1.2",
370 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
371 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
372 | "dev": true,
373 | "dependencies": {
374 | "is-glob": "^4.0.1"
375 | },
376 | "engines": {
377 | "node": ">= 6"
378 | }
379 | },
380 | "node_modules/has": {
381 | "version": "1.0.3",
382 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
383 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
384 | "dependencies": {
385 | "function-bind": "^1.1.1"
386 | },
387 | "engines": {
388 | "node": ">= 0.4.0"
389 | }
390 | },
391 | "node_modules/has-flag": {
392 | "version": "3.0.0",
393 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
394 | "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
395 | "dev": true,
396 | "engines": {
397 | "node": ">=4"
398 | }
399 | },
400 | "node_modules/has-symbols": {
401 | "version": "1.0.3",
402 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
403 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
404 | "engines": {
405 | "node": ">= 0.4"
406 | },
407 | "funding": {
408 | "url": "https://github.com/sponsors/ljharb"
409 | }
410 | },
411 | "node_modules/http-errors": {
412 | "version": "2.0.0",
413 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
414 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
415 | "dependencies": {
416 | "depd": "2.0.0",
417 | "inherits": "2.0.4",
418 | "setprototypeof": "1.2.0",
419 | "statuses": "2.0.1",
420 | "toidentifier": "1.0.1"
421 | },
422 | "engines": {
423 | "node": ">= 0.8"
424 | }
425 | },
426 | "node_modules/iconv-lite": {
427 | "version": "0.4.24",
428 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
429 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
430 | "dependencies": {
431 | "safer-buffer": ">= 2.1.2 < 3"
432 | },
433 | "engines": {
434 | "node": ">=0.10.0"
435 | }
436 | },
437 | "node_modules/ignore-by-default": {
438 | "version": "1.0.1",
439 | "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
440 | "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
441 | "dev": true
442 | },
443 | "node_modules/inherits": {
444 | "version": "2.0.4",
445 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
446 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
447 | },
448 | "node_modules/ipaddr.js": {
449 | "version": "1.9.1",
450 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
451 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
452 | "engines": {
453 | "node": ">= 0.10"
454 | }
455 | },
456 | "node_modules/is-binary-path": {
457 | "version": "2.1.0",
458 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
459 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
460 | "dev": true,
461 | "dependencies": {
462 | "binary-extensions": "^2.0.0"
463 | },
464 | "engines": {
465 | "node": ">=8"
466 | }
467 | },
468 | "node_modules/is-extglob": {
469 | "version": "2.1.1",
470 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
471 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
472 | "dev": true,
473 | "engines": {
474 | "node": ">=0.10.0"
475 | }
476 | },
477 | "node_modules/is-glob": {
478 | "version": "4.0.3",
479 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
480 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
481 | "dev": true,
482 | "dependencies": {
483 | "is-extglob": "^2.1.1"
484 | },
485 | "engines": {
486 | "node": ">=0.10.0"
487 | }
488 | },
489 | "node_modules/is-number": {
490 | "version": "7.0.0",
491 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
492 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
493 | "dev": true,
494 | "engines": {
495 | "node": ">=0.12.0"
496 | }
497 | },
498 | "node_modules/media-typer": {
499 | "version": "0.3.0",
500 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
501 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
502 | "engines": {
503 | "node": ">= 0.6"
504 | }
505 | },
506 | "node_modules/merge-descriptors": {
507 | "version": "1.0.1",
508 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
509 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
510 | },
511 | "node_modules/methods": {
512 | "version": "1.1.2",
513 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
514 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
515 | "engines": {
516 | "node": ">= 0.6"
517 | }
518 | },
519 | "node_modules/mime": {
520 | "version": "1.6.0",
521 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
522 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
523 | "bin": {
524 | "mime": "cli.js"
525 | },
526 | "engines": {
527 | "node": ">=4"
528 | }
529 | },
530 | "node_modules/mime-db": {
531 | "version": "1.52.0",
532 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
533 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
534 | "engines": {
535 | "node": ">= 0.6"
536 | }
537 | },
538 | "node_modules/mime-types": {
539 | "version": "2.1.35",
540 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
541 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
542 | "dependencies": {
543 | "mime-db": "1.52.0"
544 | },
545 | "engines": {
546 | "node": ">= 0.6"
547 | }
548 | },
549 | "node_modules/minimatch": {
550 | "version": "3.1.2",
551 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
552 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
553 | "dev": true,
554 | "dependencies": {
555 | "brace-expansion": "^1.1.7"
556 | },
557 | "engines": {
558 | "node": "*"
559 | }
560 | },
561 | "node_modules/ms": {
562 | "version": "2.0.0",
563 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
564 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
565 | },
566 | "node_modules/negotiator": {
567 | "version": "0.6.3",
568 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
569 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
570 | "engines": {
571 | "node": ">= 0.6"
572 | }
573 | },
574 | "node_modules/nodemon": {
575 | "version": "2.0.22",
576 | "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz",
577 | "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==",
578 | "dev": true,
579 | "dependencies": {
580 | "chokidar": "^3.5.2",
581 | "debug": "^3.2.7",
582 | "ignore-by-default": "^1.0.1",
583 | "minimatch": "^3.1.2",
584 | "pstree.remy": "^1.1.8",
585 | "semver": "^5.7.1",
586 | "simple-update-notifier": "^1.0.7",
587 | "supports-color": "^5.5.0",
588 | "touch": "^3.1.0",
589 | "undefsafe": "^2.0.5"
590 | },
591 | "bin": {
592 | "nodemon": "bin/nodemon.js"
593 | },
594 | "engines": {
595 | "node": ">=8.10.0"
596 | },
597 | "funding": {
598 | "type": "opencollective",
599 | "url": "https://opencollective.com/nodemon"
600 | }
601 | },
602 | "node_modules/nodemon/node_modules/debug": {
603 | "version": "3.2.7",
604 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
605 | "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
606 | "dev": true,
607 | "dependencies": {
608 | "ms": "^2.1.1"
609 | }
610 | },
611 | "node_modules/nodemon/node_modules/ms": {
612 | "version": "2.1.3",
613 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
614 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
615 | "dev": true
616 | },
617 | "node_modules/nopt": {
618 | "version": "1.0.10",
619 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
620 | "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
621 | "dev": true,
622 | "dependencies": {
623 | "abbrev": "1"
624 | },
625 | "bin": {
626 | "nopt": "bin/nopt.js"
627 | },
628 | "engines": {
629 | "node": "*"
630 | }
631 | },
632 | "node_modules/normalize-path": {
633 | "version": "3.0.0",
634 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
635 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
636 | "dev": true,
637 | "engines": {
638 | "node": ">=0.10.0"
639 | }
640 | },
641 | "node_modules/object-inspect": {
642 | "version": "1.12.3",
643 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
644 | "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
645 | "funding": {
646 | "url": "https://github.com/sponsors/ljharb"
647 | }
648 | },
649 | "node_modules/on-finished": {
650 | "version": "2.4.1",
651 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
652 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
653 | "dependencies": {
654 | "ee-first": "1.1.1"
655 | },
656 | "engines": {
657 | "node": ">= 0.8"
658 | }
659 | },
660 | "node_modules/parseurl": {
661 | "version": "1.3.3",
662 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
663 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
664 | "engines": {
665 | "node": ">= 0.8"
666 | }
667 | },
668 | "node_modules/path-to-regexp": {
669 | "version": "0.1.7",
670 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
671 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
672 | },
673 | "node_modules/picomatch": {
674 | "version": "2.3.1",
675 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
676 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
677 | "dev": true,
678 | "engines": {
679 | "node": ">=8.6"
680 | },
681 | "funding": {
682 | "url": "https://github.com/sponsors/jonschlinkert"
683 | }
684 | },
685 | "node_modules/proxy-addr": {
686 | "version": "2.0.7",
687 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
688 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
689 | "dependencies": {
690 | "forwarded": "0.2.0",
691 | "ipaddr.js": "1.9.1"
692 | },
693 | "engines": {
694 | "node": ">= 0.10"
695 | }
696 | },
697 | "node_modules/pstree.remy": {
698 | "version": "1.1.8",
699 | "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
700 | "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
701 | "dev": true
702 | },
703 | "node_modules/qs": {
704 | "version": "6.11.0",
705 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
706 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
707 | "dependencies": {
708 | "side-channel": "^1.0.4"
709 | },
710 | "engines": {
711 | "node": ">=0.6"
712 | },
713 | "funding": {
714 | "url": "https://github.com/sponsors/ljharb"
715 | }
716 | },
717 | "node_modules/range-parser": {
718 | "version": "1.2.1",
719 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
720 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
721 | "engines": {
722 | "node": ">= 0.6"
723 | }
724 | },
725 | "node_modules/raw-body": {
726 | "version": "2.5.1",
727 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
728 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
729 | "dependencies": {
730 | "bytes": "3.1.2",
731 | "http-errors": "2.0.0",
732 | "iconv-lite": "0.4.24",
733 | "unpipe": "1.0.0"
734 | },
735 | "engines": {
736 | "node": ">= 0.8"
737 | }
738 | },
739 | "node_modules/readdirp": {
740 | "version": "3.6.0",
741 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
742 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
743 | "dev": true,
744 | "dependencies": {
745 | "picomatch": "^2.2.1"
746 | },
747 | "engines": {
748 | "node": ">=8.10.0"
749 | }
750 | },
751 | "node_modules/safe-buffer": {
752 | "version": "5.2.1",
753 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
754 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
755 | "funding": [
756 | {
757 | "type": "github",
758 | "url": "https://github.com/sponsors/feross"
759 | },
760 | {
761 | "type": "patreon",
762 | "url": "https://www.patreon.com/feross"
763 | },
764 | {
765 | "type": "consulting",
766 | "url": "https://feross.org/support"
767 | }
768 | ]
769 | },
770 | "node_modules/safer-buffer": {
771 | "version": "2.1.2",
772 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
773 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
774 | },
775 | "node_modules/semver": {
776 | "version": "5.7.1",
777 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
778 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
779 | "dev": true,
780 | "bin": {
781 | "semver": "bin/semver"
782 | }
783 | },
784 | "node_modules/send": {
785 | "version": "0.18.0",
786 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
787 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
788 | "dependencies": {
789 | "debug": "2.6.9",
790 | "depd": "2.0.0",
791 | "destroy": "1.2.0",
792 | "encodeurl": "~1.0.2",
793 | "escape-html": "~1.0.3",
794 | "etag": "~1.8.1",
795 | "fresh": "0.5.2",
796 | "http-errors": "2.0.0",
797 | "mime": "1.6.0",
798 | "ms": "2.1.3",
799 | "on-finished": "2.4.1",
800 | "range-parser": "~1.2.1",
801 | "statuses": "2.0.1"
802 | },
803 | "engines": {
804 | "node": ">= 0.8.0"
805 | }
806 | },
807 | "node_modules/send/node_modules/ms": {
808 | "version": "2.1.3",
809 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
810 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
811 | },
812 | "node_modules/serve-static": {
813 | "version": "1.15.0",
814 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
815 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
816 | "dependencies": {
817 | "encodeurl": "~1.0.2",
818 | "escape-html": "~1.0.3",
819 | "parseurl": "~1.3.3",
820 | "send": "0.18.0"
821 | },
822 | "engines": {
823 | "node": ">= 0.8.0"
824 | }
825 | },
826 | "node_modules/setprototypeof": {
827 | "version": "1.2.0",
828 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
829 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
830 | },
831 | "node_modules/side-channel": {
832 | "version": "1.0.4",
833 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
834 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
835 | "dependencies": {
836 | "call-bind": "^1.0.0",
837 | "get-intrinsic": "^1.0.2",
838 | "object-inspect": "^1.9.0"
839 | },
840 | "funding": {
841 | "url": "https://github.com/sponsors/ljharb"
842 | }
843 | },
844 | "node_modules/simple-update-notifier": {
845 | "version": "1.1.0",
846 | "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz",
847 | "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==",
848 | "dev": true,
849 | "dependencies": {
850 | "semver": "~7.0.0"
851 | },
852 | "engines": {
853 | "node": ">=8.10.0"
854 | }
855 | },
856 | "node_modules/simple-update-notifier/node_modules/semver": {
857 | "version": "7.0.0",
858 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
859 | "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
860 | "dev": true,
861 | "bin": {
862 | "semver": "bin/semver.js"
863 | }
864 | },
865 | "node_modules/statuses": {
866 | "version": "2.0.1",
867 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
868 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
869 | "engines": {
870 | "node": ">= 0.8"
871 | }
872 | },
873 | "node_modules/supports-color": {
874 | "version": "5.5.0",
875 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
876 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
877 | "dev": true,
878 | "dependencies": {
879 | "has-flag": "^3.0.0"
880 | },
881 | "engines": {
882 | "node": ">=4"
883 | }
884 | },
885 | "node_modules/to-regex-range": {
886 | "version": "5.0.1",
887 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
888 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
889 | "dev": true,
890 | "dependencies": {
891 | "is-number": "^7.0.0"
892 | },
893 | "engines": {
894 | "node": ">=8.0"
895 | }
896 | },
897 | "node_modules/toidentifier": {
898 | "version": "1.0.1",
899 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
900 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
901 | "engines": {
902 | "node": ">=0.6"
903 | }
904 | },
905 | "node_modules/touch": {
906 | "version": "3.1.0",
907 | "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
908 | "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
909 | "dev": true,
910 | "dependencies": {
911 | "nopt": "~1.0.10"
912 | },
913 | "bin": {
914 | "nodetouch": "bin/nodetouch.js"
915 | }
916 | },
917 | "node_modules/type-is": {
918 | "version": "1.6.18",
919 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
920 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
921 | "dependencies": {
922 | "media-typer": "0.3.0",
923 | "mime-types": "~2.1.24"
924 | },
925 | "engines": {
926 | "node": ">= 0.6"
927 | }
928 | },
929 | "node_modules/undefsafe": {
930 | "version": "2.0.5",
931 | "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
932 | "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
933 | "dev": true
934 | },
935 | "node_modules/unpipe": {
936 | "version": "1.0.0",
937 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
938 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
939 | "engines": {
940 | "node": ">= 0.8"
941 | }
942 | },
943 | "node_modules/utils-merge": {
944 | "version": "1.0.1",
945 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
946 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
947 | "engines": {
948 | "node": ">= 0.4.0"
949 | }
950 | },
951 | "node_modules/vary": {
952 | "version": "1.1.2",
953 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
954 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
955 | "engines": {
956 | "node": ">= 0.8"
957 | }
958 | }
959 | }
960 | }
961 |
--------------------------------------------------------------------------------
/08 - API/API Project 01/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "express": "^4.18.2"
4 | },
5 | "name": "api-project-01",
6 | "version": "1.0.0",
7 | "main": "index.js",
8 | "scripts": {
9 | "test": "echo \"Error: no test specified\" && exit 1",
10 | "start": "nodemon index.js"
11 | },
12 | "keywords": [],
13 | "author": "",
14 | "license": "ISC",
15 | "description": "",
16 | "devDependencies": {
17 | "nodemon": "^2.0.22"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/08 - API/API Project 02/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 |
3 | const middleware = require('./middlewares')
4 | const routes = require('./routes')
5 |
6 | const app = express();
7 |
8 |
9 | /**
10 | * Middlewares
11 | */
12 | middleware(app);
13 |
14 |
15 | /**
16 | * Routes
17 | */
18 | routes(app)
19 |
20 |
21 | module.exports = app
--------------------------------------------------------------------------------
/08 - API/API Project 02/configurations/db.js:
--------------------------------------------------------------------------------
1 | const { MongoClient } = require('mongodb')
2 |
3 | const _uri = "mongodb://localhost:27017"
4 |
5 | const dbConnection = (collection, cb) => {
6 | MongoClient.connect(_uri)
7 | .then(async (client) => {
8 | const db = client.db('nodejs_project').collection(collection);
9 | await cb(db)
10 | client.close();
11 | })
12 | .catch();
13 | }
14 |
15 | module.exports = dbConnection
--------------------------------------------------------------------------------
/08 - API/API Project 02/controllers/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | studentController: require('./student')
3 | }
--------------------------------------------------------------------------------
/08 - API/API Project 02/controllers/student.js:
--------------------------------------------------------------------------------
1 | const getProfile = (req, res, next) => {
2 | const studentId = req.query.id;
3 |
4 | // query db
5 | res.status(200).json({
6 | id: studentId,
7 | name: "Ahmed",
8 | collage: 'IT'
9 | })
10 | };
11 |
12 | const getGrades = (req, res, next) => {
13 | res.status(200).json([
14 | {name: 'web', grade: 80},
15 | {name: 'node', grade: 40}
16 | ])
17 | };
18 |
19 | module.exports = {
20 | getGrades, getProfile
21 | }
--------------------------------------------------------------------------------
/08 - API/API Project 02/index.js:
--------------------------------------------------------------------------------
1 | const http = require('http')
2 | const app = require('./app')
3 |
4 | const server = http.createServer(app)
5 |
6 | server.listen(5000, () => {
7 | console.log('Server is listening now')
8 | })
--------------------------------------------------------------------------------
/08 - API/API Project 02/middlewares/index.js:
--------------------------------------------------------------------------------
1 | module.exports = (app) => {
2 | app.use((req, res, next) => {
3 | const lang = req.query.lang;
4 |
5 | if (lang && (lang === 'ar' || lang === 'en')) {
6 | next();
7 | }
8 |
9 | res.status(400).json({
10 | error: 'lang is required...'
11 | })
12 | })
13 |
14 | app.use((req, res, next) => {
15 | if (req.url.startsWith('/auth')) {
16 | next();
17 | }
18 |
19 | // some task
20 | next(); // required -> must or must not next
21 | })
22 | }
--------------------------------------------------------------------------------
/08 - API/API Project 02/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-project-02",
3 | "version": "1.0.0",
4 | "lockfileVersion": 3,
5 | "requires": true,
6 | "packages": {
7 | "": {
8 | "name": "api-project-02",
9 | "version": "1.0.0",
10 | "license": "ISC",
11 | "dependencies": {
12 | "express": "^4.18.2",
13 | "morgan": "^1.10.0",
14 | "nodemon": "^2.0.22"
15 | }
16 | },
17 | "node_modules/abbrev": {
18 | "version": "1.1.1",
19 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
20 | "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
21 | },
22 | "node_modules/accepts": {
23 | "version": "1.3.8",
24 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
25 | "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
26 | "dependencies": {
27 | "mime-types": "~2.1.34",
28 | "negotiator": "0.6.3"
29 | },
30 | "engines": {
31 | "node": ">= 0.6"
32 | }
33 | },
34 | "node_modules/anymatch": {
35 | "version": "3.1.3",
36 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
37 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
38 | "dependencies": {
39 | "normalize-path": "^3.0.0",
40 | "picomatch": "^2.0.4"
41 | },
42 | "engines": {
43 | "node": ">= 8"
44 | }
45 | },
46 | "node_modules/array-flatten": {
47 | "version": "1.1.1",
48 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
49 | "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
50 | },
51 | "node_modules/balanced-match": {
52 | "version": "1.0.2",
53 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
54 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
55 | },
56 | "node_modules/basic-auth": {
57 | "version": "2.0.1",
58 | "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
59 | "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
60 | "dependencies": {
61 | "safe-buffer": "5.1.2"
62 | },
63 | "engines": {
64 | "node": ">= 0.8"
65 | }
66 | },
67 | "node_modules/basic-auth/node_modules/safe-buffer": {
68 | "version": "5.1.2",
69 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
70 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
71 | },
72 | "node_modules/binary-extensions": {
73 | "version": "2.2.0",
74 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
75 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
76 | "engines": {
77 | "node": ">=8"
78 | }
79 | },
80 | "node_modules/body-parser": {
81 | "version": "1.20.1",
82 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
83 | "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
84 | "dependencies": {
85 | "bytes": "3.1.2",
86 | "content-type": "~1.0.4",
87 | "debug": "2.6.9",
88 | "depd": "2.0.0",
89 | "destroy": "1.2.0",
90 | "http-errors": "2.0.0",
91 | "iconv-lite": "0.4.24",
92 | "on-finished": "2.4.1",
93 | "qs": "6.11.0",
94 | "raw-body": "2.5.1",
95 | "type-is": "~1.6.18",
96 | "unpipe": "1.0.0"
97 | },
98 | "engines": {
99 | "node": ">= 0.8",
100 | "npm": "1.2.8000 || >= 1.4.16"
101 | }
102 | },
103 | "node_modules/brace-expansion": {
104 | "version": "1.1.11",
105 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
106 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
107 | "dependencies": {
108 | "balanced-match": "^1.0.0",
109 | "concat-map": "0.0.1"
110 | }
111 | },
112 | "node_modules/braces": {
113 | "version": "3.0.2",
114 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
115 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
116 | "dependencies": {
117 | "fill-range": "^7.0.1"
118 | },
119 | "engines": {
120 | "node": ">=8"
121 | }
122 | },
123 | "node_modules/bytes": {
124 | "version": "3.1.2",
125 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
126 | "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
127 | "engines": {
128 | "node": ">= 0.8"
129 | }
130 | },
131 | "node_modules/call-bind": {
132 | "version": "1.0.2",
133 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
134 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
135 | "dependencies": {
136 | "function-bind": "^1.1.1",
137 | "get-intrinsic": "^1.0.2"
138 | },
139 | "funding": {
140 | "url": "https://github.com/sponsors/ljharb"
141 | }
142 | },
143 | "node_modules/chokidar": {
144 | "version": "3.5.3",
145 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
146 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
147 | "funding": [
148 | {
149 | "type": "individual",
150 | "url": "https://paulmillr.com/funding/"
151 | }
152 | ],
153 | "dependencies": {
154 | "anymatch": "~3.1.2",
155 | "braces": "~3.0.2",
156 | "glob-parent": "~5.1.2",
157 | "is-binary-path": "~2.1.0",
158 | "is-glob": "~4.0.1",
159 | "normalize-path": "~3.0.0",
160 | "readdirp": "~3.6.0"
161 | },
162 | "engines": {
163 | "node": ">= 8.10.0"
164 | },
165 | "optionalDependencies": {
166 | "fsevents": "~2.3.2"
167 | }
168 | },
169 | "node_modules/concat-map": {
170 | "version": "0.0.1",
171 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
172 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
173 | },
174 | "node_modules/content-disposition": {
175 | "version": "0.5.4",
176 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
177 | "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
178 | "dependencies": {
179 | "safe-buffer": "5.2.1"
180 | },
181 | "engines": {
182 | "node": ">= 0.6"
183 | }
184 | },
185 | "node_modules/content-type": {
186 | "version": "1.0.5",
187 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
188 | "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
189 | "engines": {
190 | "node": ">= 0.6"
191 | }
192 | },
193 | "node_modules/cookie": {
194 | "version": "0.5.0",
195 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
196 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
197 | "engines": {
198 | "node": ">= 0.6"
199 | }
200 | },
201 | "node_modules/cookie-signature": {
202 | "version": "1.0.6",
203 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
204 | "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
205 | },
206 | "node_modules/debug": {
207 | "version": "2.6.9",
208 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
209 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
210 | "dependencies": {
211 | "ms": "2.0.0"
212 | }
213 | },
214 | "node_modules/depd": {
215 | "version": "2.0.0",
216 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
217 | "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
218 | "engines": {
219 | "node": ">= 0.8"
220 | }
221 | },
222 | "node_modules/destroy": {
223 | "version": "1.2.0",
224 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
225 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
226 | "engines": {
227 | "node": ">= 0.8",
228 | "npm": "1.2.8000 || >= 1.4.16"
229 | }
230 | },
231 | "node_modules/ee-first": {
232 | "version": "1.1.1",
233 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
234 | "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
235 | },
236 | "node_modules/encodeurl": {
237 | "version": "1.0.2",
238 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
239 | "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
240 | "engines": {
241 | "node": ">= 0.8"
242 | }
243 | },
244 | "node_modules/escape-html": {
245 | "version": "1.0.3",
246 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
247 | "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
248 | },
249 | "node_modules/etag": {
250 | "version": "1.8.1",
251 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
252 | "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
253 | "engines": {
254 | "node": ">= 0.6"
255 | }
256 | },
257 | "node_modules/express": {
258 | "version": "4.18.2",
259 | "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
260 | "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
261 | "dependencies": {
262 | "accepts": "~1.3.8",
263 | "array-flatten": "1.1.1",
264 | "body-parser": "1.20.1",
265 | "content-disposition": "0.5.4",
266 | "content-type": "~1.0.4",
267 | "cookie": "0.5.0",
268 | "cookie-signature": "1.0.6",
269 | "debug": "2.6.9",
270 | "depd": "2.0.0",
271 | "encodeurl": "~1.0.2",
272 | "escape-html": "~1.0.3",
273 | "etag": "~1.8.1",
274 | "finalhandler": "1.2.0",
275 | "fresh": "0.5.2",
276 | "http-errors": "2.0.0",
277 | "merge-descriptors": "1.0.1",
278 | "methods": "~1.1.2",
279 | "on-finished": "2.4.1",
280 | "parseurl": "~1.3.3",
281 | "path-to-regexp": "0.1.7",
282 | "proxy-addr": "~2.0.7",
283 | "qs": "6.11.0",
284 | "range-parser": "~1.2.1",
285 | "safe-buffer": "5.2.1",
286 | "send": "0.18.0",
287 | "serve-static": "1.15.0",
288 | "setprototypeof": "1.2.0",
289 | "statuses": "2.0.1",
290 | "type-is": "~1.6.18",
291 | "utils-merge": "1.0.1",
292 | "vary": "~1.1.2"
293 | },
294 | "engines": {
295 | "node": ">= 0.10.0"
296 | }
297 | },
298 | "node_modules/fill-range": {
299 | "version": "7.0.1",
300 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
301 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
302 | "dependencies": {
303 | "to-regex-range": "^5.0.1"
304 | },
305 | "engines": {
306 | "node": ">=8"
307 | }
308 | },
309 | "node_modules/finalhandler": {
310 | "version": "1.2.0",
311 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
312 | "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
313 | "dependencies": {
314 | "debug": "2.6.9",
315 | "encodeurl": "~1.0.2",
316 | "escape-html": "~1.0.3",
317 | "on-finished": "2.4.1",
318 | "parseurl": "~1.3.3",
319 | "statuses": "2.0.1",
320 | "unpipe": "~1.0.0"
321 | },
322 | "engines": {
323 | "node": ">= 0.8"
324 | }
325 | },
326 | "node_modules/forwarded": {
327 | "version": "0.2.0",
328 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
329 | "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
330 | "engines": {
331 | "node": ">= 0.6"
332 | }
333 | },
334 | "node_modules/fresh": {
335 | "version": "0.5.2",
336 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
337 | "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
338 | "engines": {
339 | "node": ">= 0.6"
340 | }
341 | },
342 | "node_modules/fsevents": {
343 | "version": "2.3.2",
344 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
345 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
346 | "hasInstallScript": true,
347 | "optional": true,
348 | "os": [
349 | "darwin"
350 | ],
351 | "engines": {
352 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
353 | }
354 | },
355 | "node_modules/function-bind": {
356 | "version": "1.1.1",
357 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
358 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
359 | },
360 | "node_modules/get-intrinsic": {
361 | "version": "1.2.0",
362 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
363 | "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
364 | "dependencies": {
365 | "function-bind": "^1.1.1",
366 | "has": "^1.0.3",
367 | "has-symbols": "^1.0.3"
368 | },
369 | "funding": {
370 | "url": "https://github.com/sponsors/ljharb"
371 | }
372 | },
373 | "node_modules/glob-parent": {
374 | "version": "5.1.2",
375 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
376 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
377 | "dependencies": {
378 | "is-glob": "^4.0.1"
379 | },
380 | "engines": {
381 | "node": ">= 6"
382 | }
383 | },
384 | "node_modules/has": {
385 | "version": "1.0.3",
386 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
387 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
388 | "dependencies": {
389 | "function-bind": "^1.1.1"
390 | },
391 | "engines": {
392 | "node": ">= 0.4.0"
393 | }
394 | },
395 | "node_modules/has-flag": {
396 | "version": "3.0.0",
397 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
398 | "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
399 | "engines": {
400 | "node": ">=4"
401 | }
402 | },
403 | "node_modules/has-symbols": {
404 | "version": "1.0.3",
405 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
406 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
407 | "engines": {
408 | "node": ">= 0.4"
409 | },
410 | "funding": {
411 | "url": "https://github.com/sponsors/ljharb"
412 | }
413 | },
414 | "node_modules/http-errors": {
415 | "version": "2.0.0",
416 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
417 | "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
418 | "dependencies": {
419 | "depd": "2.0.0",
420 | "inherits": "2.0.4",
421 | "setprototypeof": "1.2.0",
422 | "statuses": "2.0.1",
423 | "toidentifier": "1.0.1"
424 | },
425 | "engines": {
426 | "node": ">= 0.8"
427 | }
428 | },
429 | "node_modules/iconv-lite": {
430 | "version": "0.4.24",
431 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
432 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
433 | "dependencies": {
434 | "safer-buffer": ">= 2.1.2 < 3"
435 | },
436 | "engines": {
437 | "node": ">=0.10.0"
438 | }
439 | },
440 | "node_modules/ignore-by-default": {
441 | "version": "1.0.1",
442 | "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
443 | "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA=="
444 | },
445 | "node_modules/inherits": {
446 | "version": "2.0.4",
447 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
448 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
449 | },
450 | "node_modules/ipaddr.js": {
451 | "version": "1.9.1",
452 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
453 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
454 | "engines": {
455 | "node": ">= 0.10"
456 | }
457 | },
458 | "node_modules/is-binary-path": {
459 | "version": "2.1.0",
460 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
461 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
462 | "dependencies": {
463 | "binary-extensions": "^2.0.0"
464 | },
465 | "engines": {
466 | "node": ">=8"
467 | }
468 | },
469 | "node_modules/is-extglob": {
470 | "version": "2.1.1",
471 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
472 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
473 | "engines": {
474 | "node": ">=0.10.0"
475 | }
476 | },
477 | "node_modules/is-glob": {
478 | "version": "4.0.3",
479 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
480 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
481 | "dependencies": {
482 | "is-extglob": "^2.1.1"
483 | },
484 | "engines": {
485 | "node": ">=0.10.0"
486 | }
487 | },
488 | "node_modules/is-number": {
489 | "version": "7.0.0",
490 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
491 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
492 | "engines": {
493 | "node": ">=0.12.0"
494 | }
495 | },
496 | "node_modules/media-typer": {
497 | "version": "0.3.0",
498 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
499 | "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
500 | "engines": {
501 | "node": ">= 0.6"
502 | }
503 | },
504 | "node_modules/merge-descriptors": {
505 | "version": "1.0.1",
506 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
507 | "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
508 | },
509 | "node_modules/methods": {
510 | "version": "1.1.2",
511 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
512 | "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
513 | "engines": {
514 | "node": ">= 0.6"
515 | }
516 | },
517 | "node_modules/mime": {
518 | "version": "1.6.0",
519 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
520 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
521 | "bin": {
522 | "mime": "cli.js"
523 | },
524 | "engines": {
525 | "node": ">=4"
526 | }
527 | },
528 | "node_modules/mime-db": {
529 | "version": "1.52.0",
530 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
531 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
532 | "engines": {
533 | "node": ">= 0.6"
534 | }
535 | },
536 | "node_modules/mime-types": {
537 | "version": "2.1.35",
538 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
539 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
540 | "dependencies": {
541 | "mime-db": "1.52.0"
542 | },
543 | "engines": {
544 | "node": ">= 0.6"
545 | }
546 | },
547 | "node_modules/minimatch": {
548 | "version": "3.1.2",
549 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
550 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
551 | "dependencies": {
552 | "brace-expansion": "^1.1.7"
553 | },
554 | "engines": {
555 | "node": "*"
556 | }
557 | },
558 | "node_modules/morgan": {
559 | "version": "1.10.0",
560 | "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
561 | "integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==",
562 | "dependencies": {
563 | "basic-auth": "~2.0.1",
564 | "debug": "2.6.9",
565 | "depd": "~2.0.0",
566 | "on-finished": "~2.3.0",
567 | "on-headers": "~1.0.2"
568 | },
569 | "engines": {
570 | "node": ">= 0.8.0"
571 | }
572 | },
573 | "node_modules/morgan/node_modules/on-finished": {
574 | "version": "2.3.0",
575 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
576 | "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==",
577 | "dependencies": {
578 | "ee-first": "1.1.1"
579 | },
580 | "engines": {
581 | "node": ">= 0.8"
582 | }
583 | },
584 | "node_modules/ms": {
585 | "version": "2.0.0",
586 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
587 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
588 | },
589 | "node_modules/negotiator": {
590 | "version": "0.6.3",
591 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
592 | "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
593 | "engines": {
594 | "node": ">= 0.6"
595 | }
596 | },
597 | "node_modules/nodemon": {
598 | "version": "2.0.22",
599 | "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz",
600 | "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==",
601 | "dependencies": {
602 | "chokidar": "^3.5.2",
603 | "debug": "^3.2.7",
604 | "ignore-by-default": "^1.0.1",
605 | "minimatch": "^3.1.2",
606 | "pstree.remy": "^1.1.8",
607 | "semver": "^5.7.1",
608 | "simple-update-notifier": "^1.0.7",
609 | "supports-color": "^5.5.0",
610 | "touch": "^3.1.0",
611 | "undefsafe": "^2.0.5"
612 | },
613 | "bin": {
614 | "nodemon": "bin/nodemon.js"
615 | },
616 | "engines": {
617 | "node": ">=8.10.0"
618 | },
619 | "funding": {
620 | "type": "opencollective",
621 | "url": "https://opencollective.com/nodemon"
622 | }
623 | },
624 | "node_modules/nodemon/node_modules/debug": {
625 | "version": "3.2.7",
626 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
627 | "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
628 | "dependencies": {
629 | "ms": "^2.1.1"
630 | }
631 | },
632 | "node_modules/nodemon/node_modules/ms": {
633 | "version": "2.1.3",
634 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
635 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
636 | },
637 | "node_modules/nopt": {
638 | "version": "1.0.10",
639 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
640 | "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
641 | "dependencies": {
642 | "abbrev": "1"
643 | },
644 | "bin": {
645 | "nopt": "bin/nopt.js"
646 | },
647 | "engines": {
648 | "node": "*"
649 | }
650 | },
651 | "node_modules/normalize-path": {
652 | "version": "3.0.0",
653 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
654 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
655 | "engines": {
656 | "node": ">=0.10.0"
657 | }
658 | },
659 | "node_modules/object-inspect": {
660 | "version": "1.12.3",
661 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
662 | "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
663 | "funding": {
664 | "url": "https://github.com/sponsors/ljharb"
665 | }
666 | },
667 | "node_modules/on-finished": {
668 | "version": "2.4.1",
669 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
670 | "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
671 | "dependencies": {
672 | "ee-first": "1.1.1"
673 | },
674 | "engines": {
675 | "node": ">= 0.8"
676 | }
677 | },
678 | "node_modules/on-headers": {
679 | "version": "1.0.2",
680 | "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
681 | "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
682 | "engines": {
683 | "node": ">= 0.8"
684 | }
685 | },
686 | "node_modules/parseurl": {
687 | "version": "1.3.3",
688 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
689 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
690 | "engines": {
691 | "node": ">= 0.8"
692 | }
693 | },
694 | "node_modules/path-to-regexp": {
695 | "version": "0.1.7",
696 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
697 | "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
698 | },
699 | "node_modules/picomatch": {
700 | "version": "2.3.1",
701 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
702 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
703 | "engines": {
704 | "node": ">=8.6"
705 | },
706 | "funding": {
707 | "url": "https://github.com/sponsors/jonschlinkert"
708 | }
709 | },
710 | "node_modules/proxy-addr": {
711 | "version": "2.0.7",
712 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
713 | "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
714 | "dependencies": {
715 | "forwarded": "0.2.0",
716 | "ipaddr.js": "1.9.1"
717 | },
718 | "engines": {
719 | "node": ">= 0.10"
720 | }
721 | },
722 | "node_modules/pstree.remy": {
723 | "version": "1.1.8",
724 | "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
725 | "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w=="
726 | },
727 | "node_modules/qs": {
728 | "version": "6.11.0",
729 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
730 | "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
731 | "dependencies": {
732 | "side-channel": "^1.0.4"
733 | },
734 | "engines": {
735 | "node": ">=0.6"
736 | },
737 | "funding": {
738 | "url": "https://github.com/sponsors/ljharb"
739 | }
740 | },
741 | "node_modules/range-parser": {
742 | "version": "1.2.1",
743 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
744 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
745 | "engines": {
746 | "node": ">= 0.6"
747 | }
748 | },
749 | "node_modules/raw-body": {
750 | "version": "2.5.1",
751 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
752 | "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
753 | "dependencies": {
754 | "bytes": "3.1.2",
755 | "http-errors": "2.0.0",
756 | "iconv-lite": "0.4.24",
757 | "unpipe": "1.0.0"
758 | },
759 | "engines": {
760 | "node": ">= 0.8"
761 | }
762 | },
763 | "node_modules/readdirp": {
764 | "version": "3.6.0",
765 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
766 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
767 | "dependencies": {
768 | "picomatch": "^2.2.1"
769 | },
770 | "engines": {
771 | "node": ">=8.10.0"
772 | }
773 | },
774 | "node_modules/safe-buffer": {
775 | "version": "5.2.1",
776 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
777 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
778 | "funding": [
779 | {
780 | "type": "github",
781 | "url": "https://github.com/sponsors/feross"
782 | },
783 | {
784 | "type": "patreon",
785 | "url": "https://www.patreon.com/feross"
786 | },
787 | {
788 | "type": "consulting",
789 | "url": "https://feross.org/support"
790 | }
791 | ]
792 | },
793 | "node_modules/safer-buffer": {
794 | "version": "2.1.2",
795 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
796 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
797 | },
798 | "node_modules/semver": {
799 | "version": "5.7.1",
800 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
801 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
802 | "bin": {
803 | "semver": "bin/semver"
804 | }
805 | },
806 | "node_modules/send": {
807 | "version": "0.18.0",
808 | "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
809 | "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
810 | "dependencies": {
811 | "debug": "2.6.9",
812 | "depd": "2.0.0",
813 | "destroy": "1.2.0",
814 | "encodeurl": "~1.0.2",
815 | "escape-html": "~1.0.3",
816 | "etag": "~1.8.1",
817 | "fresh": "0.5.2",
818 | "http-errors": "2.0.0",
819 | "mime": "1.6.0",
820 | "ms": "2.1.3",
821 | "on-finished": "2.4.1",
822 | "range-parser": "~1.2.1",
823 | "statuses": "2.0.1"
824 | },
825 | "engines": {
826 | "node": ">= 0.8.0"
827 | }
828 | },
829 | "node_modules/send/node_modules/ms": {
830 | "version": "2.1.3",
831 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
832 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
833 | },
834 | "node_modules/serve-static": {
835 | "version": "1.15.0",
836 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
837 | "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
838 | "dependencies": {
839 | "encodeurl": "~1.0.2",
840 | "escape-html": "~1.0.3",
841 | "parseurl": "~1.3.3",
842 | "send": "0.18.0"
843 | },
844 | "engines": {
845 | "node": ">= 0.8.0"
846 | }
847 | },
848 | "node_modules/setprototypeof": {
849 | "version": "1.2.0",
850 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
851 | "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
852 | },
853 | "node_modules/side-channel": {
854 | "version": "1.0.4",
855 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
856 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
857 | "dependencies": {
858 | "call-bind": "^1.0.0",
859 | "get-intrinsic": "^1.0.2",
860 | "object-inspect": "^1.9.0"
861 | },
862 | "funding": {
863 | "url": "https://github.com/sponsors/ljharb"
864 | }
865 | },
866 | "node_modules/simple-update-notifier": {
867 | "version": "1.1.0",
868 | "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz",
869 | "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==",
870 | "dependencies": {
871 | "semver": "~7.0.0"
872 | },
873 | "engines": {
874 | "node": ">=8.10.0"
875 | }
876 | },
877 | "node_modules/simple-update-notifier/node_modules/semver": {
878 | "version": "7.0.0",
879 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
880 | "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
881 | "bin": {
882 | "semver": "bin/semver.js"
883 | }
884 | },
885 | "node_modules/statuses": {
886 | "version": "2.0.1",
887 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
888 | "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
889 | "engines": {
890 | "node": ">= 0.8"
891 | }
892 | },
893 | "node_modules/supports-color": {
894 | "version": "5.5.0",
895 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
896 | "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
897 | "dependencies": {
898 | "has-flag": "^3.0.0"
899 | },
900 | "engines": {
901 | "node": ">=4"
902 | }
903 | },
904 | "node_modules/to-regex-range": {
905 | "version": "5.0.1",
906 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
907 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
908 | "dependencies": {
909 | "is-number": "^7.0.0"
910 | },
911 | "engines": {
912 | "node": ">=8.0"
913 | }
914 | },
915 | "node_modules/toidentifier": {
916 | "version": "1.0.1",
917 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
918 | "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
919 | "engines": {
920 | "node": ">=0.6"
921 | }
922 | },
923 | "node_modules/touch": {
924 | "version": "3.1.0",
925 | "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
926 | "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
927 | "dependencies": {
928 | "nopt": "~1.0.10"
929 | },
930 | "bin": {
931 | "nodetouch": "bin/nodetouch.js"
932 | }
933 | },
934 | "node_modules/type-is": {
935 | "version": "1.6.18",
936 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
937 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
938 | "dependencies": {
939 | "media-typer": "0.3.0",
940 | "mime-types": "~2.1.24"
941 | },
942 | "engines": {
943 | "node": ">= 0.6"
944 | }
945 | },
946 | "node_modules/undefsafe": {
947 | "version": "2.0.5",
948 | "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
949 | "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA=="
950 | },
951 | "node_modules/unpipe": {
952 | "version": "1.0.0",
953 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
954 | "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
955 | "engines": {
956 | "node": ">= 0.8"
957 | }
958 | },
959 | "node_modules/utils-merge": {
960 | "version": "1.0.1",
961 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
962 | "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
963 | "engines": {
964 | "node": ">= 0.4.0"
965 | }
966 | },
967 | "node_modules/vary": {
968 | "version": "1.1.2",
969 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
970 | "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
971 | "engines": {
972 | "node": ">= 0.8"
973 | }
974 | }
975 | }
976 | }
977 |
--------------------------------------------------------------------------------
/08 - API/API Project 02/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-project-02",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "start": "nodemon index.js"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "express": "^4.18.2",
15 | "morgan": "^1.10.0",
16 | "nodemon": "^2.0.22"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/08 - API/API Project 02/routes/index.js:
--------------------------------------------------------------------------------
1 | const studentRouter = require('./student')
2 |
3 | module.exports = (app) => {
4 | app.get('/home', (req, res, next) => {
5 | const html = 'Welcome to home page
'
6 | res.send(html);
7 | })
8 |
9 | app.get('/profile', (req, res, next)=> {
10 | res.send('Welcome to profile')
11 | })
12 |
13 | // get, post, put, delete
14 | app.get('/data', (req, res, next) => {
15 | console.log(req.query)
16 | const lang= req.query.lang;
17 |
18 | console.log(req.headers)
19 | const host = req.get('Host')
20 |
21 | res.status(200).json([
22 | {
23 | id: 1,
24 | name: "Something"
25 | },
26 | {
27 | id: 2,
28 | name: "something 2"
29 | }
30 | ]);
31 | })
32 |
33 | // routes group -> student
34 | app.use('/student', studentRouter)
35 | }
--------------------------------------------------------------------------------
/08 - API/API Project 02/routes/student.js:
--------------------------------------------------------------------------------
1 | const { Router } = require('express')
2 | const { studentController } = require('../controllers')
3 |
4 | const router = Router()
5 |
6 | router.get('/profile', studentController.getProfile)
7 | .get('/grades', studentController.getGrades)
8 | .get('/timetable');
9 |
10 | module.exports = router
--------------------------------------------------------------------------------
/08 - API/API Project 03/.env:
--------------------------------------------------------------------------------
1 | MONGODB_URI=mongodb://localhost:27017
2 | PORT=5000
--------------------------------------------------------------------------------
/08 - API/API Project 03/Database_Backup/books.csv:
--------------------------------------------------------------------------------
1 | 6456494251955a1242268227,Robert C. Martin,1,Clean Code,3.8333333333333335,
2 | 6456497151955a1242268228,Erich Gamma,1,Design Patterns,2.8,2.5
3 | 645649a751955a1242268229,Gayle Laakmann McDowell,6,Cracking the Coding Interview,,
4 | 645649d551955a124226822a,Robert C. Martin,1,Clean Architecture: A Craftsman’s Guide to Software Structure and Design,,
5 | 64564a2e51955a124226822b,Donald Knuth and Donald John Fuller,1,The Art of Computer Programming,,
6 | 64564a5a51955a124226822c,Steve McConnell,2,Code Complete: A Practical Handbook of Software Construction,,
7 | 64564a8051955a124226822d,John K. Ousterhout,,A Philosophy of Software Design,,
8 | 64564aab51955a124226822e,Jeff Patton,1,"User Story Mapping: Discover the Whole Story, Build the Right Product",,
9 | 64564ad251955a124226822f,,,The Rock Crusher: A Model for Flow-Based Backlog Management,,
10 | 64564b1b51955a1242268230,Karl Wiegers,1,Software Requirements Essentials: Core Practices for Successful Business Analysis,,
11 | 6456839e51955a1242268272,,10,Introduction to Java Programming,,
12 |
--------------------------------------------------------------------------------
/08 - API/API Project 03/Database_Backup/reviewers.csv:
--------------------------------------------------------------------------------
1 | 64564dd551955a1242268233,Ahmed Ali,
2 | 64564de351955a1242268234,Hosam Nano,
3 | 64564def51955a1242268235,Alberto,645f9e3d8171edf91d3fe083
4 | 64564dfb51955a1242268236,Rojy,
5 | 645de8be8794506cd595337f,Ali Aloosh,645de8be93696fbb87ec9671
6 | 645f57626ecab3f8b5b86aaa,Sarah,645f57626ecab3f8b5b86aa9
7 | 645f581594ea78eee0247ae3,Sarah,645f581594ea78eee0247ae2
8 | 6467367d8794506cd5969496,Ali Basem,6467367d2c4138f484e996b2
9 |
--------------------------------------------------------------------------------
/08 - API/API Project 03/Database_Backup/reviews.csv:
--------------------------------------------------------------------------------
1 | 64564ea251955a124226823f,6456494251955a1242268227,64564dd551955a1242268233,It's good but need more information,3.4
2 | 6456569751955a1242268243,6456494251955a1242268227,64564de351955a1242268234,I see it is a good for beginner in coding,4
3 | 6456570251955a124226824c,6456497151955a1242268228,64564de351955a1242268234,"It's not bad, but there are better",2.5
4 | 6456576c51955a1242268255,645649a751955a1242268229,64564dd551955a1242268233,good book,3.1
5 | 6456578d51955a1242268257,645649a751955a1242268229,64564def51955a1242268235,nice for learning and practicing,3.6
6 | 645657af51955a1242268259,645649a751955a1242268229,64564dfb51955a1242268236,A good technical book,3.9
7 | 6456813351955a124226825f,645649d551955a124226822a,64564def51955a1242268235,A good technical book,4.6
8 | 6456815f51955a1242268265,64564a2e51955a124226822b,64564def51955a1242268235,The syntax is good. we need for Java,4.6
9 | 6456817f51955a1242268267,64564a2e51955a124226822b,64564de351955a1242268234,Hard academy but have a good ideas,4.1
10 | 645681b251955a1242268269,64564a2e51955a124226822b,64564dfb51955a1242268236,Proovides a good sceince,4.2
11 | 6467badb8794506cd596ad60,6456494251955a1242268227,64564def51955a1242268235,Good Book,4.1
12 | 647053f85840b10446ee6057,6456497151955a1242268228,64564def51955a1242268235,It is a good book,3.1
13 |
--------------------------------------------------------------------------------
/08 - API/API Project 03/Database_Backup/users.csv:
--------------------------------------------------------------------------------
1 | 645cc43cd61e0093ffdce102,ahh1@gmail.com,Ahmed Ali,122456,ahh1
2 | 645d0dba27d8e8804e47ab07,mohaaaa@gmail.com,Mohammed,451sdfsfAAA,moha11
3 | 645de7f127d8e8804e47ab08,mohaaaaa@gmail.com,Mohammed,451sdfsfAAA,mohga11
4 | 645de81927d8e8804e47ab09,mohasaaaa@gmail.com,Mohammed,451sdfsfAAA,mohsga11
5 | 645de84b11cc64ba36c06737,mohasasaaa@gmail.com,Mohammed,$2a$12$1XJ73SfOUt0uovvgEoqQj.wYK.yIHAjSO2xkKVMMghoukEaQGv6gq,mohssga11
6 | 645de863b76ca6ff21cbd767,mohasasaaa@gmail.com,Mohammed,$2a$12$UNrro/Sgl88iNlcAZWRXzuUarjAKhwAMzj450cCPcczg9hncc0Rr6,mohssga11
7 | 645de867b76ca6ff21cbd768,mohasasaaa@gmail.com,Mohammed,$2a$12$pyDGQM6fviGoO5haCERCa.R4R8wPtsGHCxXhKmubSxHXnb2M9pwfW,mohssssga11
8 | 645de86cb76ca6ff21cbd769,mohasasaaa@gmail.com,Mohammed,$2a$12$7zjJmVI9TED.X.th70VKd.M9LDLYq7/B9RubHYVVyDdyHdpR1IyZO,mo1sssga11
9 | 645de870b76ca6ff21cbd76a,mohassasaaa@gmail.com,Moshammed,$2a$12$dKpvtWeEycSlq6.BhFd9euKTwJ.SyFQXmYfQJS7/Z8AxgxEq/lHuK,mo1sssga11
10 | 645de874b76ca6ff21cbd76b,mohassasaaa@gmail.com,Moshammed,$2a$12$juA5NuIsRjZlf0UiRONbZ.8fTYh64HbLXWPMTjYoF4jaVrJkOkuGu,sssga11
11 | 645de878b76ca6ff21cbd76c,mosssasaaa@gmail.com,Moshammed,$2a$12$l/J6KVd5QgTm3e8Q2PIYv.dxAH9TIcaJbNXDe5Vl5fthwHa0waoPG,sssga11
12 | 645de87db76ca6ff21cbd76d,mossssasaaa@gmail.com,Moshammed,$2a$12$FuX5T6hgxS5hEHYkBhFXGuHweg1uTHHnXspXhQG7znlGd.yIvymZ2,ssssga11
13 | 645de8be93696fbb87ec9671,aloosh@gmail.com,Ali Aloosh,$2a$12$UAZoc9coD6YUpL5DEJ4HC.45RFnDyUrOQuUQky7IkuFZfGKWmgYaO,aalio11
14 | 645e5981f3f9c8f3acbb9352,ommmar55@gmail.com,Omar,$2a$10$dC9oBwIMnxoEFTWccndqyeoufZLJq5a41cQUdGrsz0Tp17SzhNEVO,oma111
15 | 645f57626ecab3f8b5b86aa9,sarr2055@gmail.com,Sarah,$2a$10$8I0RRpcWkIzg4bi1uvQ2Ve1xzo/LryVHs8X1KrE8qJaFnScwxOQI2,sar50
16 | 645f581594ea78eee0247ae2,sarr12055@gmail.com,Sarah,$2a$10$Dy9.w1EqJ0WaqwiC8U49L.C0ayzTwdG8dezji867OeU1R9GfyJfxi,sa1r50
17 | 645f9dd67d10c4a8ad2ee45e,Alberto@gmail.com,Alberto,$2a$10$Yby5OHQKdzKJO5rzW7vK1.xLoEfrpPHH.C7lyzqWcajYRisvckSvq,alb12
18 | 645f9e3d8171edf91d3fe083,Albesrto@gmail.com,Alberto,$2a$10$i/ZMnNo8LtFZk7d5U/t8WO/9O7Va9yMEvhk.DDhJeNsR4/7VQotQa,alb1s2
19 | 6461f172d92303c1d0993be8,saar@gmail.com,Sarah Mohammed,1111222,staa11
20 | 6461f1f8aef5c8004f69f536,saar@gmail.com,Sarah Mohammed,1111222ABb,staa11
21 | 6461f24c9529ef6e4ec50750,saar@gmail.com,Sarah Mohammed,1111222ABb,staa11
22 | 6461f258b2676699362d2920,saar@gmail.com,Sarah Mohammed,1111222ABb,staa11
23 | 6461f26437a91fb451c5112a,saar@gmail.com,Sarah Mohammed,1111222ABb,staa11
24 | 6461f2f89a58191295de5d35,saaar@gmail.com,Sarah Mohammed,1111222ABb,staaa11
25 | 6461fe409a58191295de5d36,adoo@gmail.com,Daoud Daoud,213457,ddo11
26 | 6461ff5b1d40a2d2350cf76e,adoo@gmail.com,Daoud Daoud,213457,ddo11
27 | 64620fa27b05393eb8be7a65,hos@hotmail.com,Ali,1111,huss22
28 | 64620fa27b05393eb8be7a66,hos@hotmail.com,Hussain,1111,huss22
29 | 64620fa37b05393eb8be7a67,hos@hotmail.com,Hussain,1111,huss22
30 | 64620fc48b39d7be725a492e,hos@hotmail.com,Hussain,1111,huss22
31 | 6467367d2c4138f484e996b2,alobbao@gmail.com,Ali Basem,$2a$10$hVo15g5t0KOJnhpecKNx0.CtniTJhuvtOOLyNPq2wV.zk1M18g/Mu,bam45
32 |
--------------------------------------------------------------------------------
/08 - API/API Project 03/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const createError = require('http-errors')
3 |
4 | const { returnJson } = require('./my_modules/json_response')
5 | global.returnJson = returnJson
6 |
7 | const middleware = require('./middlewares')
8 | const routes = require('./routes')
9 |
10 | const app = express();
11 |
12 | process.on('unhandledRejection', (reason) => {
13 | process.exit(1)
14 | })
15 |
16 | /**
17 | * Middlewares
18 | */
19 | middleware.global(app);
20 |
21 |
22 | /**
23 | * Routes
24 | */
25 | routes(app)
26 |
27 | app.use((req, res, next) => {
28 | next(createError(404));
29 | })
30 |
31 | app.use((error, req, res, next) => {
32 | console.log(error)
33 | res.status(error.statusCode).json({
34 | status: {
35 | status: false,
36 | message: error.message
37 | }
38 | })
39 | })
40 |
41 |
42 | module.exports = app
--------------------------------------------------------------------------------
/08 - API/API Project 03/configurations/db.js:
--------------------------------------------------------------------------------
1 | const { MongoClient } = require('mongodb')
2 |
3 | const _uri = process.env.MONGODB_URI
4 |
5 | const dbConnection = (collection, cb) => {
6 | MongoClient.connect(_uri)
7 | .then(async (client) => {
8 | const db = client.db('nodejs_project').collection(collection);
9 | await cb(db)
10 | client.close();
11 | })
12 | .catch();
13 | }
14 |
15 | module.exports = dbConnection
--------------------------------------------------------------------------------
/08 - API/API Project 03/configurations/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | dbConnection: require('./db')
3 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/configurations/private.key:
--------------------------------------------------------------------------------
1 | secretkeykljsfjs
--------------------------------------------------------------------------------
/08 - API/API Project 03/controllers/auth.js:
--------------------------------------------------------------------------------
1 | const { User, Reviewer } = require('../models')
2 | const createError = require('http-errors')
3 | const jwt = require('jsonwebtoken')
4 | const {readFileSync} = require('fs')
5 |
6 | const signup = (req, res, next) => {
7 | const userData = req.body;
8 |
9 | // validation
10 | const validation = User.validate(userData)
11 | if (validation.error) {
12 | const error = createError(400, validation.error.message)
13 | next(error)
14 | }
15 |
16 | // check existance
17 | const user = new User(userData);
18 | user.isExist()
19 | .then(result => {
20 | if (result.check) {
21 | next(createError(409, result.message))
22 | }
23 | })
24 | .catch(err => {
25 | next(createError(500, err.message))
26 | })
27 |
28 | // insert user
29 | user.save((status) => {
30 | if (status.status) {
31 | const reviewer = new Reviewer({
32 | _user_id: status._user_id,
33 | name: user.userData.name
34 | })
35 |
36 | reviewer.save((status) => {
37 | if (status.status) {
38 | res.status(201).json({
39 | status: true,
40 | message: "User has been created successfully"
41 | })
42 | } else {
43 | next(createError(500, status.message))
44 | }
45 | })
46 | } else {
47 | next(createError(500, status.message))
48 | }
49 | });
50 | }
51 |
52 |
53 | const login = (req, res, next) => {
54 | User.login(req.body)
55 | .then(result => {
56 | if (result instanceof Error) {
57 | next(createError(result.statusCode, result.message))
58 | }
59 |
60 | // token
61 | const secretKey = readFileSync('./configurations/private.key')
62 | const token = jwt.sign(
63 | {
64 | _id: result._id,
65 | _reviewer_id: result.reviewer._id
66 | }, secretKey
67 | )
68 |
69 | res.status(200).json({
70 | status: true,
71 | token: token
72 | })
73 | })
74 | .catch(err => {
75 | next(createError(err.statusCode, err.message))
76 | })
77 | }
78 |
79 | module.exports = {
80 | signup, login
81 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/controllers/book.js:
--------------------------------------------------------------------------------
1 | const { dbConnection } = require('../configurations')
2 | const { ObjectId } = require('bson')
3 | const createError = require('http-errors')
4 |
5 | const getBooks = (req, res, next) => {
6 | const pageNum = parseInt(req.query.page);
7 |
8 | if (isNaN(pageNum)) {
9 | res.status(400).json({
10 | status: false,
11 | message: "Number of page is required"
12 | })
13 | }
14 |
15 | const limit = 10;
16 | const skip = (pageNum - 1) * 10;
17 |
18 | dbConnection('books', async (collection) => {
19 | const books = await collection.find({}).skip(skip).limit(limit).toArray();
20 | res.json(books);
21 | })
22 | }
23 |
24 | const getBooksPagesCount = (req, res, next) => {
25 | dbConnection('books', async (collection) => {
26 | const count = await collection.count({});
27 | const limit = 10;
28 |
29 | res.json({
30 | pages: Math.ceil(count / limit)
31 | })
32 | })
33 | }
34 |
35 | const getOneBook = (req, res, next) => {
36 | const id = req.params.id;
37 | if (!ObjectId.isValid(id)) {
38 | next(createError(400, 'Id is not valid'))
39 | }
40 |
41 | const _id = new ObjectId(req.params.id);
42 |
43 | dbConnection('books', async (collection) => {
44 | try {
45 | const book = collection.findOne({'_id': _id});
46 |
47 | if (!book) {
48 | const error = createError(404, 'Resource is not found')
49 | next(error)
50 | }
51 |
52 | res.json(book);
53 | } catch (err) {
54 | const error = createError(500, err.message)
55 | next(error);
56 | }
57 | })
58 | }
59 |
60 | module.exports = {
61 | getBooks, getBooksPagesCount, getOneBook
62 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/controllers/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | bookController: require('./book'),
3 | authController: require('./auth'),
4 | reviewController: require('./review')
5 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/controllers/review.js:
--------------------------------------------------------------------------------
1 | const { Review, Book } = require('../models')
2 | const createError = require('http-errors')
3 | const {ObjectId} = require("bson");
4 | const {returnJson} = require("../my_modules/json_response");
5 |
6 | const add = (req, res, next) => {
7 | const reviewData = req.body
8 | reviewData._reviewer_id = req._reviewer_id
9 |
10 | const validation = Review.validate(reviewData)
11 | if (validation.error) {
12 | return next(createError(400, validation.error.message))
13 | }
14 |
15 | const review = new Review(reviewData)
16 |
17 | review.reviewData._reviewer_id = new ObjectId(review.reviewData._reviewer_id)
18 | review.reviewData._book_id = new ObjectId(review.reviewData._book_id)
19 |
20 | review.save((result) => {
21 | if (!result.status) {
22 | return next(createError(500))
23 | }
24 |
25 | Book.refreshAvgRating(review.reviewData._book_id)
26 |
27 | return returnJson(res, 200, true, "", review.reviewData)
28 | })
29 | }
30 |
31 | const remove = (req, res, next) => {
32 | const _id = new ObjectId(req.params.id);
33 |
34 | Review.getOne(_id)
35 | .then(result => {
36 | if (!result.status) {
37 | return next(createError(404))
38 | }
39 |
40 | const review = result.data;
41 |
42 | Review.remove(_id, (result) => {
43 | if (!result.status) {
44 | return next(createError(500, result.message))
45 | }
46 |
47 | Book.refreshAvgRating(review._book_id)
48 |
49 | return returnJson(res, 200, true, "", null)
50 | // res.status(200).json(result);
51 | })
52 | })
53 | .catch(err => {
54 | return next(createError(500, result.message))
55 | })
56 | }
57 |
58 | module.exports = {
59 | add, remove
60 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/index.js:
--------------------------------------------------------------------------------
1 | require('dotenv').config()
2 |
3 | const http = require('http')
4 | const app = require('./app')
5 |
6 | const server = http.createServer(app)
7 |
8 | server.listen(process.env.PORT, () => {
9 | console.log('Server is listening now')
10 | })
--------------------------------------------------------------------------------
/08 - API/API Project 03/middlewares/auth.js:
--------------------------------------------------------------------------------
1 | const createError = require('http-errors')
2 | const { readFileSync } = require('fs')
3 | const jwt = require('jsonwebtoken')
4 |
5 | module.exports = (req, res, next) => {
6 | const authHeader = req.get('Authorization');
7 |
8 | if (!authHeader) {
9 | return next(createError(401))
10 | }
11 |
12 | const token = authHeader.split(' ')[1]
13 | const secret = readFileSync('./configurations/private.key')
14 |
15 | try {
16 | const decode = jwt.verify(token, secret)
17 | req._user_id = decode._id
18 | req._reviewer_id = decode._reviewer_id
19 | next()
20 | } catch (err) {
21 | return next(createError(401))
22 | }
23 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/middlewares/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 |
3 | module.exports = {
4 | global: (app) => {
5 | app.use((req, res, next) => {
6 | next();
7 | })
8 |
9 | app.use(express.json());
10 | },
11 |
12 | auth: require('./auth')
13 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/models/Book.js:
--------------------------------------------------------------------------------
1 | const {dbConnection} = require('../configurations')
2 |
3 | class Book {
4 |
5 | static refreshAvgRating (_book_id) {
6 | dbConnection('reviews', async (collection) => {
7 | const reviews = await collection.find(
8 | {_book_id: _book_id}
9 | ).toArray()
10 |
11 | const count = reviews.length
12 | let sum = 0
13 |
14 | for (let i = 0 ; i < count ; i++) {
15 | if (reviews[i].rating) {
16 | sum += reviews[i].rating
17 | }
18 | }
19 |
20 | const avg = sum / count
21 |
22 | dbConnection('books', async (collection) => {
23 | await collection.updateOne(
24 | {_id: _book_id},
25 | {$set: {rating: avg}}
26 | )
27 | })
28 | })
29 | }
30 | }
31 |
32 | module.exports = Book
--------------------------------------------------------------------------------
/08 - API/API Project 03/models/Review.js:
--------------------------------------------------------------------------------
1 | const {dbConnection} = require('../configurations')
2 | const {reviewValidator} = require("../validators");
3 |
4 | class Review {
5 | constructor(reviewData) {
6 | this.reviewData = reviewData
7 | }
8 |
9 | save(cb) {
10 | dbConnection('reviews', async (collection) => {
11 | try {
12 | await collection.updateOne(
13 | {
14 | _book_id: this.reviewData._book_id,
15 | _reviewer_id: this.reviewData._reviewer_id
16 | },
17 | {
18 | $set: {
19 | _book_id: this.reviewData._book_id,
20 | _reviewer_id: this.reviewData._reviewer_id,
21 | rating: this.reviewData.rating,
22 | comment: this.reviewData.comment
23 | }
24 | },
25 | {
26 | upsert: true
27 | }
28 | )
29 |
30 | cb({
31 | status: true
32 | })
33 | } catch (err) {
34 | cb({
35 | status: false,
36 | message: err.message
37 | })
38 | }
39 | })
40 | }
41 |
42 | static remove (_id, cb) {
43 | dbConnection('reviews', async (collection) => {
44 | try {
45 | await collection.deleteOne({_id})
46 |
47 | cb({status: true})
48 | } catch (err) {
49 | cb({status: false, message: err.message})
50 | }
51 | })
52 | }
53 |
54 | static getOne (_id) {
55 | return new Promise((resolve, reject) => {
56 | dbConnection('reviews', async (collection) => {
57 | try {
58 | const review = await collection.findOne({_id})
59 |
60 | if (review) {
61 | resolve({status: true, data: review})
62 | } else {
63 | resolve({status: false})
64 | }
65 | } catch (err) {
66 | reject({status: false, message: err.message})
67 | }
68 | })
69 | })
70 | }
71 |
72 | static validate(reviewData) {
73 | const validation = reviewValidator.validate(reviewData)
74 | return validation
75 | }
76 | }
77 |
78 | module.exports = Review
--------------------------------------------------------------------------------
/08 - API/API Project 03/models/Reviewer.js:
--------------------------------------------------------------------------------
1 | const { dbConnection } = require('../configurations')
2 |
3 | class Reviewer {
4 | constructor(reviewerData) {
5 | this.reviewerData = reviewerData
6 | }
7 |
8 | save(cb) {
9 | dbConnection('reviewers', async (collection) => {
10 | try {
11 | await collection.updateOne(
12 | {name: this.reviewerData.name, _user_id: null},
13 | {$set: {_user_id: this.reviewerData._user_id, name: this.reviewerData.name}},
14 | {upsert: true}
15 | )
16 |
17 | cb({
18 | status: true
19 | })
20 | } catch (err) {
21 | cb({
22 | status: false,
23 | message: err.message
24 | })
25 | }
26 | })
27 | }
28 | }
29 |
30 | module.exports = Reviewer
--------------------------------------------------------------------------------
/08 - API/API Project 03/models/User.js:
--------------------------------------------------------------------------------
1 | const { dbConnection } = require('../configurations')
2 | const { userValidator, loginValidator } = require('../validators')
3 | const { hashSync, compareSync } = require('bcryptjs')
4 |
5 | class User {
6 | constructor(userData) {
7 | this.userData = userData;
8 | }
9 |
10 | save(cb) {
11 | dbConnection('users', async (collection) => {
12 | try {
13 | const hashedPassword = hashSync(this.userData.password, 12)
14 | this.userData.password = hashedPassword
15 |
16 | await collection.insertOne(this.userData)
17 | .then(result => {
18 | cb({
19 | status: true,
20 | _user_id: result.insertedId
21 | })
22 | })
23 |
24 | } catch (err) {
25 | cb({
26 | status: false,
27 | message: err.message
28 | })
29 | }
30 | })
31 | }
32 |
33 | isExist() {
34 | return new Promise((resolve, reject) => {
35 | dbConnection('users', async (collection) => {
36 | try {
37 | const user = await collection.findOne({
38 | '$or': [
39 | {username: this.userData.username},
40 | {email: this.userData.email}
41 | ]
42 | })
43 |
44 | if (!user) {
45 | resolve({
46 | check: false
47 | })
48 | } else {
49 | if (user.email === this.userData.email) {
50 | resolve({
51 | check: true,
52 | message: 'The email is already used'
53 | })
54 | } else if (user.username === this.userData.username) {
55 | resolve({
56 | check: true,
57 | message: 'The username is already used'
58 | })
59 | }
60 | }
61 | } catch (err) {
62 | reject(err)
63 | }
64 | })
65 | })
66 | }
67 |
68 | static validate(userData) {
69 | try {
70 | const validationResult = userValidator.validate(userData)
71 | return validationResult;
72 | } catch (err) {
73 | return false;
74 | }
75 | }
76 |
77 | static login(loginData) {
78 | return new Promise((resolve, reject) => {
79 | // validation
80 | const validation = loginValidator.validate(loginData)
81 | if (validation.error) {
82 | const error = new Error(validation.error.message)
83 | error.statusCode = 400
84 | resolve(error)
85 | }
86 |
87 | // find user
88 | dbConnection('users', async (collection) => {
89 | try {
90 | const dbResult = await collection.aggregate([
91 | {
92 | $lookup: {
93 | from: 'reviewers',
94 | localField: '_id',
95 | foreignField: '_user_id',
96 | as: 'reviewer'
97 | }
98 | },
99 | {
100 | $match: {
101 | username: loginData.username
102 | }
103 | },
104 | {
105 | $limit: 1
106 | }
107 | ]).toArray()
108 |
109 |
110 | // const user = await collection.findOne(
111 | // {username: loginData.username},
112 | // {projection: {username: 1, password: 1}}
113 | // )
114 |
115 | if (dbResult) {
116 | const user = dbResult[0]
117 |
118 | if (!user || !compareSync(loginData.password, user.password)) {
119 | const error = new Error('Wrong or not found username or password')
120 | error.statusCode = 401
121 | resolve(error)
122 | }
123 |
124 | user.reviewer = (user.reviewer) ? user.reviewer[0] : null
125 | resolve(user)
126 | } else {
127 | const error = new Error('Wrong or not found username or password')
128 | error.statusCode = 401
129 | resolve(error)
130 | }
131 |
132 | // dbConnection('reviewers', async (relatedCollection) => {
133 | // const reviewer = await relatedCollection.findOne(
134 | // {_user_id: user._id}
135 | // )
136 | //
137 | // user.reviewer = reviewer;
138 | //
139 | // resolve(user);
140 | // })
141 |
142 | // resolve(user)
143 | } catch (err) {
144 | reject(err)
145 | }
146 | })
147 | })
148 | }
149 | }
150 |
151 | // const user = new User({
152 | // name: 'Ahmed Ali',
153 | // email: 'hamm@gmail.com',
154 | // username: 'aali',
155 | // password: '11111aaaaa'
156 | // })
157 |
158 | // User.validate(user.userData)
159 |
160 | // user.save()
161 |
162 | // user.isExist()
163 | // .then(result => {
164 | // console.log(result);
165 | // })
166 | // .catch(err => console.log(err))
167 |
168 |
169 | module.exports = User
--------------------------------------------------------------------------------
/08 - API/API Project 03/models/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | User: require('./User'),
3 | Reviewer: require('./Reviewer'),
4 | Review: require('./Review'),
5 | Book: require('./Book')
6 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/my_modules/json_response/index.js:
--------------------------------------------------------------------------------
1 | const returnJson = (res, statusCode, status, message, data) => {
2 | return res.status(statusCode).json(
3 | {
4 | status: {
5 | status: status,
6 | message: message
7 | },
8 | data: data
9 | }
10 | )
11 | }
12 |
13 | module.exports = {
14 | returnJson
15 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "api-project-03",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "start": "nodemon index.js"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "@hapi/joi": "^17.1.1",
15 | "bcryptjs": "^2.4.3",
16 | "bson": "^5.2.0",
17 | "dotenv": "^16.0.3",
18 | "express": "^4.18.2",
19 | "http-errors": "^2.0.0",
20 | "jsonwebtoken": "^9.0.0",
21 | "mongodb": "^5.4.0",
22 | "nodemon": "^2.0.22"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/08 - API/API Project 03/routes/auth.js:
--------------------------------------------------------------------------------
1 | const { Router } = require('express')
2 | const { authController } = require('../controllers')
3 |
4 |
5 | const router = Router()
6 |
7 | router.post('/signup', authController.signup)
8 | .post('/login', authController.login);
9 |
10 | module.exports = router;
--------------------------------------------------------------------------------
/08 - API/API Project 03/routes/book.js:
--------------------------------------------------------------------------------
1 | const { Router } = require('express')
2 | const { bookController } = require('../controllers')
3 | const { auth } = require('../middlewares')
4 |
5 | const router = Router()
6 |
7 | router
8 | .get('/', auth, bookController.getBooks)
9 | .get('/pages-count', bookController.getBooksPagesCount)
10 | .get('/:id', bookController.getOneBook);
11 |
12 | module.exports = router
--------------------------------------------------------------------------------
/08 - API/API Project 03/routes/index.js:
--------------------------------------------------------------------------------
1 | const bookRouter = require('./book')
2 | const authRouter = require('./auth')
3 | const reviewRouter = require('./review')
4 |
5 | module.exports = (app) => {
6 | app.get('/', (req, res, next) => {
7 | res.status(200).json({
8 | status: true,
9 | message: null,
10 | })
11 | })
12 |
13 | app.use('/books', bookRouter)
14 |
15 | app.use('/auth', authRouter);
16 |
17 | app.use('/reviews', reviewRouter);
18 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/routes/review.js:
--------------------------------------------------------------------------------
1 | const {Router} = require('express')
2 | const { reviewController } = require('../controllers')
3 | const {auth} = require('../middlewares')
4 |
5 | const router = Router()
6 |
7 | router.post('/add', auth, reviewController.add)
8 | .delete('/delete/:id', auth, reviewController.remove)
9 |
10 | module.exports = router
--------------------------------------------------------------------------------
/08 - API/API Project 03/validators/index.js:
--------------------------------------------------------------------------------
1 | const userValidator = require('./user')
2 | const reviewValidator = require('./review')
3 |
4 | module.exports = {
5 | userValidator: userValidator.schema,
6 | loginValidator: userValidator.loginSchema,
7 | reviewValidator
8 | }
--------------------------------------------------------------------------------
/08 - API/API Project 03/validators/review.js:
--------------------------------------------------------------------------------
1 | const Joi = require('@hapi/joi')
2 |
3 | const schema = Joi.object({
4 | _book_id: Joi.string().required(),
5 | _reviewer_id: Joi.string().required(),
6 | comment: Joi.string().required(),
7 | rating: Joi.number().required()
8 | })
9 |
10 | module.exports = schema
--------------------------------------------------------------------------------
/08 - API/API Project 03/validators/user.js:
--------------------------------------------------------------------------------
1 | const Joi = require('@hapi/joi')
2 |
3 | const schema = Joi.object({
4 | name: Joi.string().required(),
5 | email: Joi.string().email().required(),
6 | username: Joi.string().alphanum().required().min(3).max(10),
7 | password: Joi.string()
8 | .pattern(new RegExp('^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$'))
9 | .message('Password must be >= 8 digits and contains lower, upper and number digits')
10 | .required()
11 | })
12 |
13 | const loginSchema = Joi.object({
14 | username: Joi.string().alphanum().required().min(3).max(10),
15 | password: Joi.string()
16 | .pattern(new RegExp('^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$'))
17 | .message('Password must be >= 8 digits and contains lower, upper and number digits')
18 | .required()
19 | })
20 |
21 | module.exports = {
22 | schema, loginSchema
23 | };
--------------------------------------------------------------------------------