├── .babelrc ├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── api ├── desafio │ └── index.html └── index.html ├── css └── style.css ├── fundamentos ├── desafio │ ├── css │ │ └── style.css │ ├── index.html │ └── projeto │ │ ├── css │ │ └── style.css │ │ ├── index.html │ │ └── js │ │ ├── script-babel.js │ │ └── script.js ├── index.html └── trabalho-pratico │ ├── index.html │ └── projeto │ ├── css │ └── style.css │ ├── index.html │ └── js │ ├── script-babel.js │ └── script.js ├── img ├── github.png ├── home.png └── linkedin.png ├── index.html ├── mongodb ├── index.html └── trabalho-pratico │ ├── index.html │ └── projeto │ ├── app.js │ ├── models │ └── account.js │ ├── package-lock.json │ ├── package.json │ └── routes │ └── accountsRouter.js ├── package-lock.json ├── package.json └── react ├── desafio ├── index.html └── projeto │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt │ ├── src │ ├── App.css │ ├── App.js │ ├── components │ │ ├── Form │ │ │ └── Form.js │ │ └── Installments │ │ │ ├── Installment │ │ │ └── Installment.js │ │ │ └── Installments.js │ ├── index.css │ └── index.js │ └── yarn.lock ├── index.html └── trabalho-pratico ├── index.html └── projeto ├── .gitignore ├── README.md ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.css ├── App.js ├── App.test.js ├── Components │ ├── InputFullSalary │ │ └── InputFullSalary.js │ ├── InputReadOnly │ │ ├── Input │ │ │ └── Input.js │ │ └── InputReadOnly.js │ └── ProgressBarSalary │ │ └── ProgressBarSalary.js ├── SalaryCalculations │ └── salary.js ├── index.css ├── index.js ├── logo.svg ├── serviceWorker.js └── setupTests.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Testtzlaffe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bootcamp Full Stack [em andamento / construção] 2 | 3 | Resultados 4 | 5 | Em maio de 2020 iniciei a participação no Bootcamp 6 | Full Stack da IGTI. O programa tem como objetivo oferecer uma formação 7 | prática e intensiva em algumas tecnologias para desenvolvedor full 8 | stack. São 148h de aulas, em pouco mais de 2 meses. 9 | 10 | O Bootcamp apresenta técnicas de construção de uma aplicação passando 11 | pelo back-end (Node.js e Express), front-end (vanilla JavaScript e 12 | React), persistência de dados NoSQL (MongoDB), controle de 13 | versionamento de código com Git e implantação em nuvem. 14 | 15 | Em vez de separar cada projeto desenvolvido neste bootcamp, centralizei em um único repositório do curso todos os arquivos. Para uma melhor visualização da evolução no bootcamp, organizei tudo neste site. 16 | -------------------------------------------------------------------------------- /api/desafio/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 23 | 24 | 26 | 31 |
32 |

Bootcamp Full Stack

33 |

Fundamentos: Desafio

34 |
35 |
36 |
37 |

38 | O objetivo desta aplicação é pesquisar registros de usuários obtidos por uma API. O exercício era que a consulta fosse realizada após o clique em um botão, ou pressionar [enter], mas entendi que se a busca fosse realizada imediatamente ao digitar, haveria um ganho na experiência do usuário. Procurei também desenvolver uma aplicação responsiva. 39 |

40 |

41 | Gostei bastante deste desafio, principalmente por poder aplicar modernas features do JavaScript, tais como async/await, arrow functions e template literals, além de usar array methods como map, filter e reduce. 42 |

43 |

44 | Te convido a dar uma olhadinha no código, no qual tentei aplicar funções bem definidas. Qualquer envio de sugestão de melhorias será de muito valor para meu aprendizado! Preparado para o próximo módulo: APIs com Node.js. 45 |

46 | 47 | 50 | 51 | 52 | 55 | 56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 | 31 |

Bootcamp Full Stack

32 |

Construção de APIs com Node.js

33 |
34 |
35 |
36 |

37 | Neste módulo utilizamos ..... 38 |

39 |

40 | O destaque desta etapa foi .... 41 |

42 | 43 |

44 | Abaixo, seguem o projeto do desafio final deste módulo. 45 |

46 |
47 |
48 | 49 |
50 |
51 |
API
52 |
Desafio
53 |

54 | Node.js. 55 |

56 | Detalhes 57 |
58 |
59 |
60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 1rem; 3 | color: #333; 4 | } 5 | 6 | @media (max-width: 500px) { 7 | h1 { 8 | font-size: 1.4rem; 9 | } 10 | h2 { 11 | font-size: 1rem; 12 | } 13 | } 14 | 15 | .container { 16 | max-width: 800px; 17 | } 18 | 19 | .icon { 20 | height: 40px; 21 | margin-right: 10px; 22 | margin-left: 10px; 23 | } 24 | 25 | /* .github-img { 26 | height: 60px; 27 | } */ 28 | 29 | .card { 30 | width: 18rem; 31 | margin: 20px; 32 | } 33 | 34 | .cardfooter { 35 | color: #aaa; 36 | } 37 | 38 | .card-title { 39 | color: rgb(110, 90, 190); 40 | } 41 | 42 | .card-link, 43 | .number, 44 | .name { 45 | color: rgb(110, 90, 190); 46 | } 47 | 48 | .header { 49 | background-color: rgb(110, 90, 190); 50 | } 51 | 52 | .btn-prim { 53 | background-color: rgb(110, 90, 190); 54 | color: white; 55 | } 56 | -------------------------------------------------------------------------------- /fundamentos/desafio/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 1rem; 3 | color: #333; 4 | } 5 | 6 | @media (max-width: 500px) { 7 | h1 { 8 | font-size: 1.4rem; 9 | } 10 | h2 { 11 | font-size: 1rem; 12 | } 13 | } 14 | .form { 15 | display: flex; 16 | } 17 | 18 | .form-control { 19 | margin-bottom: 10px; 20 | } 21 | 22 | .container { 23 | max-width: 800px; 24 | } 25 | 26 | .icon { 27 | width: 50px; 28 | } 29 | -------------------------------------------------------------------------------- /fundamentos/desafio/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 23 | 24 | 26 | 31 |
32 |

Bootcamp Full Stack

33 |

Fundamentos: Desafio

34 |
35 |
36 |
37 |

38 | O objetivo desta aplicação é pesquisar registros de usuários obtidos por uma API. O exercício era que a consulta fosse realizada após o clique em um botão, ou pressionar [enter], mas entendi que se a busca fosse realizada imediatamente ao digitar, haveria um ganho na experiência do usuário. Procurei também desenvolver uma aplicação responsiva. 39 |

40 |

41 | Gostei bastante deste desafio, principalmente por poder aplicar modernas features do JavaScript, tais como async/await, arrow functions e template literals, além de usar array methods como map, filter e reduce. 42 |

43 |

44 | Te convido a dar uma olhadinha no código, no qual tentei aplicar funções bem definidas. Qualquer envio de sugestão de melhorias será de muito valor para meu aprendizado! Preparado para o próximo módulo: APIs com Node.js. 45 |

46 | 47 | 50 | 51 | 52 | 55 | 56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /fundamentos/desafio/projeto/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 1rem; 3 | color: #333; 4 | } 5 | 6 | @media (max-width: 500px) { 7 | h1 { 8 | font-size: 1.4rem; 9 | } 10 | h2 { 11 | font-size: 1rem; 12 | } 13 | } 14 | 15 | .form { 16 | display: flex; 17 | } 18 | 19 | .form-control { 20 | margin-bottom: 10px; 21 | } 22 | 23 | .container { 24 | max-width: 800px; 25 | } 26 | 27 | .results { 28 | width: 100%; 29 | } 30 | 31 | .card { 32 | margin: 5px; 33 | padding: 5px; 34 | } 35 | 36 | ul { 37 | list-style: none; 38 | padding: 0; 39 | margin-top: 10px; 40 | } 41 | 42 | li { 43 | border-bottom: 1px solid #ddd; 44 | padding: 10px; 45 | } 46 | 47 | .photo { 48 | border-radius: 50%; 49 | } 50 | 51 | input { 52 | margin-top: 30px; 53 | margin-bottom: 30px; 54 | } 55 | 56 | .name { 57 | margin-left: 10px; 58 | } 59 | 60 | .idade { 61 | color: #ccc; 62 | } 63 | 64 | #statistics { 65 | display: none; 66 | } 67 | -------------------------------------------------------------------------------- /fundamentos/desafio/projeto/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | User Search 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 | 22 | 24 | 25 | 27 | 32 |
33 |

Bootcamp Full Stack

34 |

User Search

35 |
36 |
37 |
38 | 45 | 46 |
47 |
48 | 51 |
52 |
53 |
54 |
0
55 |
Total de usuários filtrados
56 |
57 |
58 |
0
59 |
Sexo masculino
60 |
61 |
62 |
0
63 |
Sexo feminino
64 |
65 |
66 |
0
67 |
Soma das idades
68 |
69 |
70 |
0
71 |
Média das idades
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /fundamentos/desafio/projeto/js/script-babel.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 4 | 5 | function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 6 | 7 | // lists 8 | var allUsers = []; 9 | var filteredUsers = []; // elements 10 | 11 | var inputElement = null; 12 | var userListInfoElement = null; 13 | var totalFilteredUsersElement = null; 14 | var totalFilteredFemaleElement = null; 15 | var totalFilteredMaleElement = null; 16 | var totalUsers = null; 17 | var ageSumElement = null; 18 | var ageAverageElement = null; 19 | var button = null; 20 | var showStatisticsElement = null; 21 | var statisticsElement = null; // statistics 22 | 23 | var totalFilteredUsers = 0; 24 | var totalFilteredMale = 0; 25 | var totalFilteredFemale = 0; 26 | var ageSum = 0; 27 | var showStatistics = false; 28 | var numberFormat = Intl.NumberFormat("pt-BR"); 29 | window.addEventListener("load", function () { 30 | selectElements(); 31 | fetchUsers(); 32 | }); 33 | 34 | var selectElements = function selectElements() { 35 | inputElement = document.querySelector("#name"); 36 | inputElement.focus(); 37 | inputElement.addEventListener("input", filterUsers); 38 | userListInfoElement = document.querySelector("#listInfo"); 39 | totalFilteredUsersElement = document.querySelector("#totalFilteredUsers"); 40 | totalFilteredMaleElement = document.querySelector("#totalFilteredMale"); 41 | totalFilteredFemaleElement = document.querySelector("#totalFilteredFemale"); 42 | ageSumElement = document.querySelector("#ageSum"); 43 | ageAverageElement = document.querySelector("#ageAverage"); 44 | button = document.querySelector("button"); 45 | showStatisticsElement = document.querySelector("#showStatistics"); 46 | showStatisticsElement.addEventListener("click", toggleStatistics); 47 | statisticsElement = document.querySelector("#statistics"); 48 | console.log(showStatisticsElement); 49 | }; 50 | 51 | var fetchUsers = /*#__PURE__*/function () { 52 | var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { 53 | var res, json; 54 | return regeneratorRuntime.wrap(function _callee$(_context) { 55 | while (1) { 56 | switch (_context.prev = _context.next) { 57 | case 0: 58 | _context.next = 2; 59 | return fetch("https://randomuser.me/api/?seed=javascript&results=100&nat=BR&noinfo"); 60 | 61 | case 2: 62 | res = _context.sent; 63 | _context.next = 5; 64 | return res.json(); 65 | 66 | case 5: 67 | json = _context.sent; 68 | console.log(json); 69 | allUsers = json.results.map(function (user) { 70 | var gender = user.gender, 71 | name = user.name, 72 | dob = user.dob, 73 | picture = user.picture; 74 | var completeName = "".concat(name.first, " ").concat(name.last); 75 | return { 76 | completeName: completeName, 77 | age: dob.age, 78 | gender: gender, 79 | thumbnail: picture.thumbnail 80 | }; 81 | }); 82 | 83 | case 8: 84 | case "end": 85 | return _context.stop(); 86 | } 87 | } 88 | }, _callee); 89 | })); 90 | 91 | return function fetchUsers() { 92 | return _ref.apply(this, arguments); 93 | }; 94 | }(); 95 | 96 | var filterUsers = function filterUsers() { 97 | var name = event.target.value.trim(); 98 | 99 | if (!name) { 100 | filteredUsers = []; 101 | } else { 102 | filteredUsers = allUsers.filter(function (user) { 103 | return user.completeName.toLowerCase().includes(name.toLowerCase()); 104 | }); 105 | filteredUsers = sortUsers(filteredUsers); 106 | } 107 | 108 | calc(); 109 | render(); 110 | }; 111 | 112 | var render = function render() { 113 | statistics(); 114 | list(); 115 | }; 116 | 117 | var sortUsers = function sortUsers() { 118 | return filteredUsers.sort(function (a, b) { 119 | return a.completeName.localeCompare(b.completeName); 120 | }); 121 | }; 122 | 123 | var list = function list() { 124 | if (!filteredUsers) { 125 | console.log("sem usuarios"); 126 | console.log(filteredUsers); 127 | console.log(totalFilteredUsers); 128 | console.log(totalFilteredUsersElement); 129 | return; 130 | } 131 | 132 | var userListHTML = ""; 137 | userListInfoElement.innerHTML = userListHTML; 138 | totalFilteredUsersElement.textContent = totalFilteredUsers; 139 | }; 140 | 141 | var statistics = function statistics() { 142 | totalFilteredMaleElement.textContent = totalFilteredMale; 143 | totalFilteredFemaleElement.textContent = totalFilteredFemale; 144 | totalFilteredUsersElement.textContent = totalFilteredUsers; 145 | ageSumElement.textContent = formatNumber(ageSum); 146 | ageAverageElement.textContent = formatNumber(ageAverage); 147 | }; 148 | 149 | var calc = function calc() { 150 | totalFilteredUsers = filteredUsers.length; 151 | totalFilteredMale = totalByGender("male"); 152 | totalFilteredFemale = totalByGender("female"); 153 | ageSum = sumAge(); 154 | ageAverage = average(); 155 | }; 156 | 157 | var totalByGender = function totalByGender(gender) { 158 | return filteredUsers.filter(function (user) { 159 | return user.gender === gender; 160 | }).length; 161 | }; 162 | 163 | var sumAge = function sumAge() { 164 | return filteredUsers.reduce(function (acc, curr) { 165 | return acc + curr.age; 166 | }, 0); 167 | }; 168 | 169 | var average = function average() { 170 | if (totalFilteredUsers === 0) { 171 | return 0; 172 | } 173 | 174 | return ageSum / totalFilteredUsers; 175 | }; 176 | 177 | var formatNumber = function formatNumber(number) { 178 | return numberFormat.format(number); 179 | }; 180 | 181 | var toggleStatistics = function toggleStatistics() { 182 | console.log(showStatistics); 183 | showStatistics = !showStatistics; 184 | var display = showStatistics ? "block" : "none"; 185 | var buttonTextContent = showStatistics ? "Esconder estatísticas" : "Mostrar estatísticas"; 186 | statisticsElement.style.display = display; 187 | showStatisticsElement.textContent = buttonTextContent; 188 | }; 189 | -------------------------------------------------------------------------------- /fundamentos/desafio/projeto/js/script.js: -------------------------------------------------------------------------------- 1 | // lists 2 | let allUsers = []; 3 | let filteredUsers = []; 4 | 5 | // elements 6 | let inputElement = null; 7 | let userListInfoElement = null; 8 | let totalFilteredUsersElement = null; 9 | let totalFilteredFemaleElement = null; 10 | let totalFilteredMaleElement = null; 11 | let totalUsers = null; 12 | let ageSumElement = null; 13 | let ageAverageElement = null; 14 | let button = null; 15 | let showStatisticsElement = null; 16 | let statisticsElement = null; 17 | 18 | // statistics 19 | let totalFilteredUsers = 0; 20 | let totalFilteredMale = 0; 21 | let totalFilteredFemale = 0; 22 | let ageSum = 0; 23 | let showStatistics = false; 24 | 25 | let numberFormat = Intl.NumberFormat("pt-BR"); 26 | 27 | window.addEventListener("load", () => { 28 | selectElements(); 29 | fetchUsers(); 30 | }); 31 | 32 | const selectElements = () => { 33 | inputElement = document.querySelector("#name"); 34 | inputElement.focus(); 35 | inputElement.addEventListener("input", filterUsers); 36 | userListInfoElement = document.querySelector("#listInfo"); 37 | totalFilteredUsersElement = document.querySelector("#totalFilteredUsers"); 38 | totalFilteredMaleElement = document.querySelector("#totalFilteredMale"); 39 | totalFilteredFemaleElement = document.querySelector("#totalFilteredFemale"); 40 | ageSumElement = document.querySelector("#ageSum"); 41 | ageAverageElement = document.querySelector("#ageAverage"); 42 | button = document.querySelector("button"); 43 | showStatisticsElement = document.querySelector("#showStatistics"); 44 | showStatisticsElement.addEventListener("click", toggleStatistics); 45 | statisticsElement = document.querySelector("#statistics"); 46 | }; 47 | 48 | const fetchUsers = async () => { 49 | const res = await fetch( 50 | "https://randomuser.me/api/?seed=javascript&results=100&nat=BR&noinfo" 51 | ); 52 | const json = await res.json(); 53 | allUsers = json.results.map((user) => { 54 | const { gender, name, dob, picture } = user; 55 | const completeName = `${name.first} ${name.last}`; 56 | return { 57 | completeName, 58 | age: dob.age, 59 | gender, 60 | thumbnail: picture.thumbnail, 61 | }; 62 | }); 63 | }; 64 | 65 | const filterUsers = () => { 66 | const name = event.target.value.trim(); 67 | if (!name) { 68 | filteredUsers = []; 69 | } else { 70 | filteredUsers = allUsers.filter((user) => { 71 | return user.completeName.toLowerCase().includes(name.toLowerCase()); 72 | }); 73 | filteredUsers = sortUsers(filteredUsers); 74 | } 75 | calc(); 76 | render(); 77 | }; 78 | 79 | const render = () => { 80 | statistics(); 81 | list(); 82 | }; 83 | 84 | const sortUsers = () => { 85 | return filteredUsers.sort((a, b) => { 86 | return a.completeName.localeCompare(b.completeName); 87 | }); 88 | }; 89 | 90 | const list = () => { 91 | if (!filteredUsers) { 92 | return; 93 | } 94 | let userListHTML = ""; 109 | userListInfoElement.innerHTML = userListHTML; 110 | totalFilteredUsersElement.textContent = totalFilteredUsers; 111 | }; 112 | 113 | const statistics = () => { 114 | totalFilteredMaleElement.textContent = totalFilteredMale; 115 | totalFilteredFemaleElement.textContent = totalFilteredFemale; 116 | totalFilteredUsersElement.textContent = totalFilteredUsers; 117 | ageSumElement.textContent = formatNumber(ageSum); 118 | ageAverageElement.textContent = formatNumber(ageAverage); 119 | }; 120 | 121 | const calc = () => { 122 | totalFilteredUsers = filteredUsers.length; 123 | totalFilteredMale = totalByGender("male"); 124 | totalFilteredFemale = totalByGender("female"); 125 | ageSum = sumAge(); 126 | ageAverage = average(); 127 | }; 128 | 129 | const totalByGender = (gender) => 130 | filteredUsers.filter((user) => user.gender === gender).length; 131 | 132 | const sumAge = () => filteredUsers.reduce((acc, curr) => acc + curr.age, 0); 133 | 134 | const average = () => { 135 | if (totalFilteredUsers === 0) { 136 | return 0; 137 | } 138 | return ageSum / totalFilteredUsers; 139 | }; 140 | 141 | const formatNumber = (number) => { 142 | return numberFormat.format(parseFloat(number).toFixed(2)); 143 | }; 144 | 145 | const toggleStatistics = () => { 146 | showStatistics = !showStatistics; 147 | const display = showStatistics ? "block" : "none"; 148 | const buttonTextContent = showStatistics 149 | ? "Esconder estatísticas" 150 | : "Mostrar estatísticas"; 151 | statisticsElement.style.display = display; 152 | showStatisticsElement.textContent = buttonTextContent; 153 | }; 154 | -------------------------------------------------------------------------------- /fundamentos/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 | 31 |

Bootcamp Full Stack

32 |

Fundamentos: JavaScript, HTML e CSS

33 |
34 |
35 |
36 |

37 | Neste módulo foram apresentadas as noções de HTML e de CSS. Pude 38 | revisitar conceitos e práticas com JavaScript, além de aprender muitas 39 | coisas novas. 40 |

41 |

42 | O destaque desta etapa foi poder criar aplicações simples, porém 43 | efetivas na fixação de conteúdo, usando JavaScript sem frameworks ou 44 | bibliotecas desta linguagem de programação. Assim, consegui visualizar 45 | o quanto JavaScript evoluiu nos últimos anos. 46 |

47 |

48 | Vale mencionar que na maioria das aulas foram apresentadas e 49 | utilizadas as novas formas de programar com JavaScript moderno (ES6+). 50 | Com JavaScript moderno, está prazeroso o desenvolvimento web. 51 |

52 |

53 | Abaixo, seguem meus dois projetos práticos desenvolvidos nesta etapa. 54 |

55 |
56 |
57 |
58 |
59 |
RGB Picker
60 |
Trabalho Prático
61 |

62 | JavaScript, HTML e CSS. 63 |

64 | Detalhes 65 |
66 |
67 |
68 |
69 |
User Search
70 |
Desafio
71 |

72 | JavaScript moderno. 73 |

74 | Detalhes 75 |
76 |
77 |
78 |
79 | 80 | 81 | -------------------------------------------------------------------------------- /fundamentos/trabalho-pratico/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 |

Bootcamp Full Stack

31 |

Fundamentos: Trabalho Prático

32 |
33 |
34 |
35 |

36 | Neste pequeno projeto, construí uma aplicação para visualização de 37 | cores a partir da escala RGB. Nela, pude exercitar os conceitos 38 | básicos no desenvolvimento web, com HTML, CSS e JavaScript. 39 |

40 |

41 | Apesar do exercício ser aplicar as cores escolhidas nos ranges em um 42 | quadrado na tela, busquei trazer uma interface na qual há um rodapé 43 | com os ranges na vertical, o que permite um alcance melhor do dedo 44 | polegar em uma tela de smartphone. E a mudança de cor ocorre no 45 | background do espaço restante. 46 |

47 |

48 | Após concluir o projeto, o refatorei para JavaScript moderno, com uso 49 | de arrow functions, variáveis const e let, entre outras mudanças. 50 |

51 |

52 | Esta etapa foi importantíssima nos estudos do bootcamp, pois me 53 | deparei com um JavaScript mais poderoso do que presenciei em cursos 54 | passados, quando eu preferia utilizar JQuery. 55 |

56 |
57 | 58 | 61 | 62 | 66 | 69 | 70 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /fundamentos/trabalho-pratico/projeto/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #ddd; 3 | font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", 4 | "Lucida Sans", Arial, sans-serif; 5 | 6 | padding: 10px; 7 | } 8 | 9 | #number-r { 10 | color: red; 11 | } 12 | 13 | #number-g { 14 | color: green; 15 | } 16 | 17 | #number-b { 18 | color: blue; 19 | } 20 | 21 | .container { 22 | display: flex; 23 | justify-content: center; 24 | height: 100%; 25 | } 26 | 27 | .card { 28 | display: inline-block; 29 | background-color: white; 30 | border-radius: 10px; 31 | } 32 | 33 | .col1, 34 | .col2, 35 | .col3 { 36 | padding: 5px; 37 | } 38 | 39 | .col1 { 40 | min-width: 30px; 41 | } 42 | 43 | .col2 { 44 | transform: rotate(-90deg); 45 | } 46 | 47 | .col3 > input { 48 | max-width: 50px; 49 | } 50 | 51 | .row { 52 | padding: 10px; 53 | display: flex; 54 | flex-direction: column; 55 | justify-content: space-around; 56 | align-items: center; 57 | } 58 | 59 | .row2 { 60 | display: flex; 61 | } 62 | 63 | .row3 { 64 | display: flex; 65 | flex-direction: row; 66 | justify-content: space-between; 67 | font-size: 1.2rem; 68 | position: fixed; 69 | bottom: 90px; 70 | } 71 | 72 | input[type="range"] { 73 | transform: rotate(-90deg); 74 | cursor: pointer; 75 | } 76 | input[type="range"], 77 | .number { 78 | width: 120px; 79 | padding: 0; 80 | } 81 | 82 | .ranges { 83 | position: fixed; 84 | bottom: 170px; 85 | } 86 | 87 | .footer { 88 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.5), 0 6px 20px 0 rgba(0, 0, 0, 0.5); 89 | display: flex; 90 | justify-content: center; 91 | position: fixed; 92 | background-color: white; 93 | left: 0; 94 | bottom: 0; 95 | width: 100%; 96 | height: 270px; 97 | 98 | text-align: center; 99 | } 100 | 101 | .bottom-footer { 102 | background-color: rgb(110, 90, 190); 103 | position: fixed; 104 | bottom: 0; 105 | padding: 10px; 106 | width: 100%; 107 | } 108 | -------------------------------------------------------------------------------- /fundamentos/trabalho-pratico/projeto/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Trabalho Prático 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 74 |
75 |
76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /fundamentos/trabalho-pratico/projeto/js/script-babel.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var rgb = ['r', 'g', 'b']; 4 | var rangeElements = []; 5 | var numberElements = []; 6 | window.addEventListener('load', function () { 7 | rgb.map(function (color) { 8 | var rangeElement = document.querySelector("#range-".concat(color)); 9 | rangeElement.addEventListener('input', changeColor); 10 | rangeElements.push(rangeElement); 11 | var numberElement = document.querySelector("#number-".concat(color)); 12 | numberElements.push(numberElement); 13 | }); 14 | changeColor(); 15 | }); 16 | 17 | var changeColor = function changeColor() { 18 | numberElements.map(function (n, i) { 19 | rgb[i] = rangeElements[i].value; 20 | n.textContent = rangeElements[i].value; 21 | }); 22 | document.querySelector('body').style.backgroundColor = "rgb(".concat(rgb.join(','), ")"); 23 | }; 24 | -------------------------------------------------------------------------------- /fundamentos/trabalho-pratico/projeto/js/script.js: -------------------------------------------------------------------------------- 1 | const rgb = ["r", "g", "b"]; 2 | const rangeElements = []; 3 | const numberElements = []; 4 | 5 | window.addEventListener("load", () => { 6 | rgb.map((color) => { 7 | const rangeElement = document.querySelector(`#range-${color}`); 8 | rangeElement.addEventListener("input", changeColor); 9 | rangeElements.push(rangeElement); 10 | const numberElement = document.querySelector(`#number-${color}`); 11 | numberElements.push(numberElement); 12 | }); 13 | changeColor(); 14 | }); 15 | 16 | const changeColor = () => { 17 | numberElements.forEach((n, i) => { 18 | rgb[i] = rangeElements[i].value; 19 | n.textContent = rangeElements[i].value; 20 | }); 21 | document.querySelector("body").style.backgroundColor = `rgb(${rgb.join( 22 | "," 23 | )})`; 24 | }; 25 | -------------------------------------------------------------------------------- /img/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/img/github.png -------------------------------------------------------------------------------- /img/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/img/home.png -------------------------------------------------------------------------------- /img/linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/img/linkedin.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 23 | 28 |
29 |

Bootcamp Full Stack

30 |

JavaScript + Node.js + React + MongoDB

31 |
32 |
33 |
34 |

35 | Em maio de 2020 iniciei a participação no Bootcamp Full Stack da IGTI. 36 | O programa tem como objetivo oferecer uma formação prática e intensiva 37 | em algumas tecnologias para desenvolvedor full stack. São 148h de 38 | aulas, em pouco mais de 2 meses. 39 |

40 |

41 | O Bootcamp apresenta técnicas de construção de uma aplicação passando 42 | pelo back-end (Node.js e Express), front-end (React), persistência de 43 | dados NoSQL (MongoDB), controle de versionamento de código com Git e 44 | implantação em nuvem. 45 |

46 |

47 | Em vez de subir separadamente ao Github cada projeto concluído neste 48 | bootcamp, preparei esta página e as demais explicando a jornada e a 49 | evolução no aprendizado. 50 |

51 |

52 | Abaixo estão listados os módulos do bootcamp. Em breve subirei todos 53 | os projetos desenvolvidos até aqui. Clicando em "Detalhes", você 54 | encontra informações específicas de cada etapa, bem como acesso aos 55 | códigos e o resultado final. 56 |

57 |
58 |
59 |
60 |
61 |
Fundamentos
62 |
Módulo 1 (34h)
63 |

64 | Desenvolvimento de aplicação simples com JavaScript puro e dados 65 | persistidos em memória. 66 |

67 | Detalhes 68 |
69 |
70 |
71 |
72 |
Desenvolvimento de APIs
73 |
Módulo 2 (34h)
74 |

75 | Criação de API com o Node.js. 76 |

77 |

78 | Desafios deste módulo ainda não foram commitados. 79 |

80 |
81 |
82 |
83 |
84 |
Front-end com React
85 |
Módulo 3 (34h)
86 |

87 | Desenvolvimento de aplicação com React, conectando-se à API criada 88 | no módulo anterior. 89 |

90 | Detalhes 91 |
92 |
93 |
94 |
95 |
96 | Persistência de dados, versionamento de código e implantação 97 |
98 |
Módulo 4 (34h)
99 |

100 | Persistência de dados com MongoDB, publicação da aplicação no 101 | Github e implantação no Heroku. 102 |

103 | Detalhes 104 |
105 |
106 |
107 |
108 | 109 | 110 | -------------------------------------------------------------------------------- /mongodb/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 | 31 |

Bootcamp Full Stack

32 |

MongoDB + Git + Deploy

33 |
34 |
35 |
36 |

37 | Neste módulo aprendi a persistir os dados com MongoDB. Utilizei a biblioteca 38 | mongoose e o MongoDB Atlas. 39 |

40 | 41 |

42 | Também tive a oportunidade de ter mais aulas sobre o Git e, ao final do módulo, 43 | pude conhecer o deploy com Heroku. 44 |

45 | 46 |

47 | Abaixo, segue o trabalho prático e o desafio desta etapa. 48 |

49 |
50 |
51 |
52 |
53 |
Accounts
54 |
Trabalho Prático
55 |

56 | MongoDB Atlas. 57 |

58 | Detalhes 59 |
60 |
61 | 62 |
63 |
64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /mongodb/trabalho-pratico/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 |

Bootcamp Full Stack

31 |

MongoDB: Trabalho Prático

32 |
33 |
34 |
35 |

36 | Neste trabalho prático, pude implementar uma API integrada ao MongoDB 37 | Atlas cujo o schema dos dados foi definido pela biblioteca mongoose. 38 | Esta API tem alguns endpoints para manipulação dos dados de contas 39 | bancárias. 40 |

41 | 42 | 47 | 51 | 54 | 55 |
56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /mongodb/trabalho-pratico/projeto/app.js: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import mongoose from "mongoose"; 3 | import { router } from "./routes/accountsRouter.js"; 4 | 5 | const app = express(); 6 | app.use(express.json()); 7 | app.use(router); 8 | 9 | (async () => { 10 | await mongoose.connect( 11 | "mongodb+srv://:@cluster0.bazmo.mongodb.net/?retryWrites=true&w=majority", 12 | { 13 | useNewUrlParser: true, 14 | useUnifiedTopology: true, 15 | } 16 | ); 17 | console.log("MongoDB Atlas connected"); 18 | })(); 19 | 20 | app.listen(3000, () => { 21 | console.log("API started"); 22 | }); 23 | -------------------------------------------------------------------------------- /mongodb/trabalho-pratico/projeto/models/account.js: -------------------------------------------------------------------------------- 1 | import mongoose from "mongoose"; 2 | 3 | const accountSchema = mongoose.Schema({ 4 | agencia: { 5 | type: Number, 6 | required: true, 7 | }, 8 | conta: { 9 | type: Number, 10 | required: true, 11 | }, 12 | name: { 13 | type: String, 14 | required: true, 15 | }, 16 | balance: { 17 | type: Number, 18 | required: true, 19 | }, 20 | }); 21 | 22 | mongoose.model("account", accountSchema); 23 | const accountModel = mongoose.model("account"); 24 | 25 | export { accountModel }; 26 | -------------------------------------------------------------------------------- /mongodb/trabalho-pratico/projeto/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "projeto", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.7", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 10 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 11 | "requires": { 12 | "mime-types": "~2.1.24", 13 | "negotiator": "0.6.2" 14 | } 15 | }, 16 | "array-flatten": { 17 | "version": "1.1.1", 18 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 19 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 20 | }, 21 | "bl": { 22 | "version": "2.2.0", 23 | "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.0.tgz", 24 | "integrity": "sha512-wbgvOpqopSr7uq6fJrLH8EsvYMJf9gzfo2jCsL2eTy75qXPukA4pCgHamOQkZtY5vmfVtjB+P3LNlMHW5CEZXA==", 25 | "requires": { 26 | "readable-stream": "^2.3.5", 27 | "safe-buffer": "^5.1.1" 28 | } 29 | }, 30 | "bluebird": { 31 | "version": "3.5.1", 32 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", 33 | "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" 34 | }, 35 | "body-parser": { 36 | "version": "1.19.0", 37 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", 38 | "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", 39 | "requires": { 40 | "bytes": "3.1.0", 41 | "content-type": "~1.0.4", 42 | "debug": "2.6.9", 43 | "depd": "~1.1.2", 44 | "http-errors": "1.7.2", 45 | "iconv-lite": "0.4.24", 46 | "on-finished": "~2.3.0", 47 | "qs": "6.7.0", 48 | "raw-body": "2.4.0", 49 | "type-is": "~1.6.17" 50 | }, 51 | "dependencies": { 52 | "debug": { 53 | "version": "2.6.9", 54 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 55 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 56 | "requires": { 57 | "ms": "2.0.0" 58 | } 59 | }, 60 | "ms": { 61 | "version": "2.0.0", 62 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 63 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 64 | } 65 | } 66 | }, 67 | "bson": { 68 | "version": "1.1.4", 69 | "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.4.tgz", 70 | "integrity": "sha512-S/yKGU1syOMzO86+dGpg2qGoDL0zvzcb262G+gqEy6TgP6rt6z6qxSFX/8X6vLC91P7G7C3nLs0+bvDzmvBA3Q==" 71 | }, 72 | "bytes": { 73 | "version": "3.1.0", 74 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", 75 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" 76 | }, 77 | "content-disposition": { 78 | "version": "0.5.3", 79 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", 80 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", 81 | "requires": { 82 | "safe-buffer": "5.1.2" 83 | }, 84 | "dependencies": { 85 | "safe-buffer": { 86 | "version": "5.1.2", 87 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 88 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 89 | } 90 | } 91 | }, 92 | "content-type": { 93 | "version": "1.0.4", 94 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 95 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 96 | }, 97 | "cookie": { 98 | "version": "0.4.0", 99 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", 100 | "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" 101 | }, 102 | "cookie-signature": { 103 | "version": "1.0.6", 104 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 105 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 106 | }, 107 | "core-util-is": { 108 | "version": "1.0.2", 109 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 110 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 111 | }, 112 | "debug": { 113 | "version": "3.1.0", 114 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", 115 | "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", 116 | "requires": { 117 | "ms": "2.0.0" 118 | }, 119 | "dependencies": { 120 | "ms": { 121 | "version": "2.0.0", 122 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 123 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 124 | } 125 | } 126 | }, 127 | "denque": { 128 | "version": "1.4.1", 129 | "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", 130 | "integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ==" 131 | }, 132 | "depd": { 133 | "version": "1.1.2", 134 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 135 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 136 | }, 137 | "destroy": { 138 | "version": "1.0.4", 139 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 140 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 141 | }, 142 | "ee-first": { 143 | "version": "1.1.1", 144 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 145 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 146 | }, 147 | "encodeurl": { 148 | "version": "1.0.2", 149 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 150 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 151 | }, 152 | "escape-html": { 153 | "version": "1.0.3", 154 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 155 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 156 | }, 157 | "etag": { 158 | "version": "1.8.1", 159 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 160 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 161 | }, 162 | "express": { 163 | "version": "4.17.1", 164 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", 165 | "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", 166 | "requires": { 167 | "accepts": "~1.3.7", 168 | "array-flatten": "1.1.1", 169 | "body-parser": "1.19.0", 170 | "content-disposition": "0.5.3", 171 | "content-type": "~1.0.4", 172 | "cookie": "0.4.0", 173 | "cookie-signature": "1.0.6", 174 | "debug": "2.6.9", 175 | "depd": "~1.1.2", 176 | "encodeurl": "~1.0.2", 177 | "escape-html": "~1.0.3", 178 | "etag": "~1.8.1", 179 | "finalhandler": "~1.1.2", 180 | "fresh": "0.5.2", 181 | "merge-descriptors": "1.0.1", 182 | "methods": "~1.1.2", 183 | "on-finished": "~2.3.0", 184 | "parseurl": "~1.3.3", 185 | "path-to-regexp": "0.1.7", 186 | "proxy-addr": "~2.0.5", 187 | "qs": "6.7.0", 188 | "range-parser": "~1.2.1", 189 | "safe-buffer": "5.1.2", 190 | "send": "0.17.1", 191 | "serve-static": "1.14.1", 192 | "setprototypeof": "1.1.1", 193 | "statuses": "~1.5.0", 194 | "type-is": "~1.6.18", 195 | "utils-merge": "1.0.1", 196 | "vary": "~1.1.2" 197 | }, 198 | "dependencies": { 199 | "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 | "requires": { 204 | "ms": "2.0.0" 205 | } 206 | }, 207 | "ms": { 208 | "version": "2.0.0", 209 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 210 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 211 | }, 212 | "safe-buffer": { 213 | "version": "5.1.2", 214 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 215 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 216 | } 217 | } 218 | }, 219 | "finalhandler": { 220 | "version": "1.1.2", 221 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 222 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 223 | "requires": { 224 | "debug": "2.6.9", 225 | "encodeurl": "~1.0.2", 226 | "escape-html": "~1.0.3", 227 | "on-finished": "~2.3.0", 228 | "parseurl": "~1.3.3", 229 | "statuses": "~1.5.0", 230 | "unpipe": "~1.0.0" 231 | }, 232 | "dependencies": { 233 | "debug": { 234 | "version": "2.6.9", 235 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 236 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 237 | "requires": { 238 | "ms": "2.0.0" 239 | } 240 | }, 241 | "ms": { 242 | "version": "2.0.0", 243 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 244 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 245 | } 246 | } 247 | }, 248 | "forwarded": { 249 | "version": "0.1.2", 250 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 251 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 252 | }, 253 | "fresh": { 254 | "version": "0.5.2", 255 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 256 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 257 | }, 258 | "http-errors": { 259 | "version": "1.7.2", 260 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", 261 | "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", 262 | "requires": { 263 | "depd": "~1.1.2", 264 | "inherits": "2.0.3", 265 | "setprototypeof": "1.1.1", 266 | "statuses": ">= 1.5.0 < 2", 267 | "toidentifier": "1.0.0" 268 | }, 269 | "dependencies": { 270 | "inherits": { 271 | "version": "2.0.3", 272 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 273 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 274 | } 275 | } 276 | }, 277 | "iconv-lite": { 278 | "version": "0.4.24", 279 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 280 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 281 | "requires": { 282 | "safer-buffer": ">= 2.1.2 < 3" 283 | } 284 | }, 285 | "inherits": { 286 | "version": "2.0.4", 287 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 288 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 289 | }, 290 | "ipaddr.js": { 291 | "version": "1.9.1", 292 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 293 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 294 | }, 295 | "isarray": { 296 | "version": "1.0.0", 297 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 298 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 299 | }, 300 | "kareem": { 301 | "version": "2.3.1", 302 | "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.1.tgz", 303 | "integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw==" 304 | }, 305 | "media-typer": { 306 | "version": "0.3.0", 307 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 308 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 309 | }, 310 | "memory-pager": { 311 | "version": "1.5.0", 312 | "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", 313 | "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", 314 | "optional": true 315 | }, 316 | "merge-descriptors": { 317 | "version": "1.0.1", 318 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 319 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 320 | }, 321 | "methods": { 322 | "version": "1.1.2", 323 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 324 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 325 | }, 326 | "mime": { 327 | "version": "1.6.0", 328 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 329 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 330 | }, 331 | "mime-db": { 332 | "version": "1.44.0", 333 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", 334 | "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" 335 | }, 336 | "mime-types": { 337 | "version": "2.1.27", 338 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", 339 | "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", 340 | "requires": { 341 | "mime-db": "1.44.0" 342 | } 343 | }, 344 | "mongodb": { 345 | "version": "3.5.9", 346 | "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.5.9.tgz", 347 | "integrity": "sha512-vXHBY1CsGYcEPoVWhwgxIBeWqP3dSu9RuRDsoLRPTITrcrgm1f0Ubu1xqF9ozMwv53agmEiZm0YGo+7WL3Nbug==", 348 | "requires": { 349 | "bl": "^2.2.0", 350 | "bson": "^1.1.4", 351 | "denque": "^1.4.1", 352 | "require_optional": "^1.0.1", 353 | "safe-buffer": "^5.1.2", 354 | "saslprep": "^1.0.0" 355 | } 356 | }, 357 | "mongoose": { 358 | "version": "5.9.21", 359 | "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.9.21.tgz", 360 | "integrity": "sha512-HQUemnKJdrE8ig+d3RTeOan6DWasmda8V97fs1ymozTNSuh2eGaf4D92/BrXYCw5QTgE/Ff5SxalndfgLn3DGg==", 361 | "requires": { 362 | "bson": "^1.1.4", 363 | "kareem": "2.3.1", 364 | "mongodb": "3.5.9", 365 | "mongoose-legacy-pluralize": "1.0.2", 366 | "mpath": "0.7.0", 367 | "mquery": "3.2.2", 368 | "ms": "2.1.2", 369 | "regexp-clone": "1.0.0", 370 | "safe-buffer": "5.1.2", 371 | "sift": "7.0.1", 372 | "sliced": "1.0.1" 373 | }, 374 | "dependencies": { 375 | "safe-buffer": { 376 | "version": "5.1.2", 377 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 378 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 379 | } 380 | } 381 | }, 382 | "mongoose-legacy-pluralize": { 383 | "version": "1.0.2", 384 | "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", 385 | "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" 386 | }, 387 | "mpath": { 388 | "version": "0.7.0", 389 | "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.7.0.tgz", 390 | "integrity": "sha512-Aiq04hILxhz1L+f7sjGyn7IxYzWm1zLNNXcfhDtx04kZ2Gk7uvFdgZ8ts1cWa/6d0TQmag2yR8zSGZUmp0tFNg==" 391 | }, 392 | "mquery": { 393 | "version": "3.2.2", 394 | "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.2.tgz", 395 | "integrity": "sha512-XB52992COp0KP230I3qloVUbkLUxJIu328HBP2t2EsxSFtf4W1HPSOBWOXf1bqxK4Xbb66lfMJ+Bpfd9/yZE1Q==", 396 | "requires": { 397 | "bluebird": "3.5.1", 398 | "debug": "3.1.0", 399 | "regexp-clone": "^1.0.0", 400 | "safe-buffer": "5.1.2", 401 | "sliced": "1.0.1" 402 | }, 403 | "dependencies": { 404 | "safe-buffer": { 405 | "version": "5.1.2", 406 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 407 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 408 | } 409 | } 410 | }, 411 | "ms": { 412 | "version": "2.1.2", 413 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 414 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 415 | }, 416 | "negotiator": { 417 | "version": "0.6.2", 418 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 419 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 420 | }, 421 | "on-finished": { 422 | "version": "2.3.0", 423 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 424 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 425 | "requires": { 426 | "ee-first": "1.1.1" 427 | } 428 | }, 429 | "parseurl": { 430 | "version": "1.3.3", 431 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 432 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 433 | }, 434 | "path-to-regexp": { 435 | "version": "0.1.7", 436 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 437 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 438 | }, 439 | "process-nextick-args": { 440 | "version": "2.0.1", 441 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 442 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 443 | }, 444 | "proxy-addr": { 445 | "version": "2.0.6", 446 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", 447 | "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", 448 | "requires": { 449 | "forwarded": "~0.1.2", 450 | "ipaddr.js": "1.9.1" 451 | } 452 | }, 453 | "qs": { 454 | "version": "6.7.0", 455 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", 456 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" 457 | }, 458 | "range-parser": { 459 | "version": "1.2.1", 460 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 461 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 462 | }, 463 | "raw-body": { 464 | "version": "2.4.0", 465 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", 466 | "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", 467 | "requires": { 468 | "bytes": "3.1.0", 469 | "http-errors": "1.7.2", 470 | "iconv-lite": "0.4.24", 471 | "unpipe": "1.0.0" 472 | } 473 | }, 474 | "readable-stream": { 475 | "version": "2.3.7", 476 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 477 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 478 | "requires": { 479 | "core-util-is": "~1.0.0", 480 | "inherits": "~2.0.3", 481 | "isarray": "~1.0.0", 482 | "process-nextick-args": "~2.0.0", 483 | "safe-buffer": "~5.1.1", 484 | "string_decoder": "~1.1.1", 485 | "util-deprecate": "~1.0.1" 486 | }, 487 | "dependencies": { 488 | "safe-buffer": { 489 | "version": "5.1.2", 490 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 491 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 492 | } 493 | } 494 | }, 495 | "regexp-clone": { 496 | "version": "1.0.0", 497 | "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-1.0.0.tgz", 498 | "integrity": "sha512-TuAasHQNamyyJ2hb97IuBEif4qBHGjPHBS64sZwytpLEqtBQ1gPJTnOaQ6qmpET16cK14kkjbazl6+p0RRv0yw==" 499 | }, 500 | "require_optional": { 501 | "version": "1.0.1", 502 | "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", 503 | "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", 504 | "requires": { 505 | "resolve-from": "^2.0.0", 506 | "semver": "^5.1.0" 507 | } 508 | }, 509 | "resolve-from": { 510 | "version": "2.0.0", 511 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", 512 | "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" 513 | }, 514 | "safe-buffer": { 515 | "version": "5.2.1", 516 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 517 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" 518 | }, 519 | "safer-buffer": { 520 | "version": "2.1.2", 521 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 522 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 523 | }, 524 | "saslprep": { 525 | "version": "1.0.3", 526 | "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz", 527 | "integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==", 528 | "optional": true, 529 | "requires": { 530 | "sparse-bitfield": "^3.0.3" 531 | } 532 | }, 533 | "semver": { 534 | "version": "5.7.1", 535 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 536 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" 537 | }, 538 | "send": { 539 | "version": "0.17.1", 540 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", 541 | "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", 542 | "requires": { 543 | "debug": "2.6.9", 544 | "depd": "~1.1.2", 545 | "destroy": "~1.0.4", 546 | "encodeurl": "~1.0.2", 547 | "escape-html": "~1.0.3", 548 | "etag": "~1.8.1", 549 | "fresh": "0.5.2", 550 | "http-errors": "~1.7.2", 551 | "mime": "1.6.0", 552 | "ms": "2.1.1", 553 | "on-finished": "~2.3.0", 554 | "range-parser": "~1.2.1", 555 | "statuses": "~1.5.0" 556 | }, 557 | "dependencies": { 558 | "debug": { 559 | "version": "2.6.9", 560 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 561 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 562 | "requires": { 563 | "ms": "2.0.0" 564 | }, 565 | "dependencies": { 566 | "ms": { 567 | "version": "2.0.0", 568 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 569 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 570 | } 571 | } 572 | }, 573 | "ms": { 574 | "version": "2.1.1", 575 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 576 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 577 | } 578 | } 579 | }, 580 | "serve-static": { 581 | "version": "1.14.1", 582 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", 583 | "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", 584 | "requires": { 585 | "encodeurl": "~1.0.2", 586 | "escape-html": "~1.0.3", 587 | "parseurl": "~1.3.3", 588 | "send": "0.17.1" 589 | } 590 | }, 591 | "setprototypeof": { 592 | "version": "1.1.1", 593 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", 594 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" 595 | }, 596 | "sift": { 597 | "version": "7.0.1", 598 | "resolved": "https://registry.npmjs.org/sift/-/sift-7.0.1.tgz", 599 | "integrity": "sha512-oqD7PMJ+uO6jV9EQCl0LrRw1OwsiPsiFQR5AR30heR+4Dl7jBBbDLnNvWiak20tzZlSE1H7RB30SX/1j/YYT7g==" 600 | }, 601 | "sliced": { 602 | "version": "1.0.1", 603 | "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", 604 | "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" 605 | }, 606 | "sparse-bitfield": { 607 | "version": "3.0.3", 608 | "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", 609 | "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", 610 | "optional": true, 611 | "requires": { 612 | "memory-pager": "^1.0.2" 613 | } 614 | }, 615 | "statuses": { 616 | "version": "1.5.0", 617 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 618 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 619 | }, 620 | "string_decoder": { 621 | "version": "1.1.1", 622 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 623 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 624 | "requires": { 625 | "safe-buffer": "~5.1.0" 626 | }, 627 | "dependencies": { 628 | "safe-buffer": { 629 | "version": "5.1.2", 630 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 631 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 632 | } 633 | } 634 | }, 635 | "toidentifier": { 636 | "version": "1.0.0", 637 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", 638 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" 639 | }, 640 | "type-is": { 641 | "version": "1.6.18", 642 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 643 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 644 | "requires": { 645 | "media-typer": "0.3.0", 646 | "mime-types": "~2.1.24" 647 | } 648 | }, 649 | "unpipe": { 650 | "version": "1.0.0", 651 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 652 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 653 | }, 654 | "util-deprecate": { 655 | "version": "1.0.2", 656 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 657 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 658 | }, 659 | "utils-merge": { 660 | "version": "1.0.1", 661 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 662 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 663 | }, 664 | "vary": { 665 | "version": "1.1.2", 666 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 667 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 668 | } 669 | } 670 | } 671 | -------------------------------------------------------------------------------- /mongodb/trabalho-pratico/projeto/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "projeto", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "express": "^4.17.1", 14 | "mongodb": "^3.5.9", 15 | "mongoose": "^5.9.21" 16 | }, 17 | "type": "module" 18 | } 19 | -------------------------------------------------------------------------------- /mongodb/trabalho-pratico/projeto/routes/accountsRouter.js: -------------------------------------------------------------------------------- 1 | import express from "express"; 2 | import { accountModel } from "../models/account.js"; 3 | 4 | const router = express.Router(); 5 | 6 | router.get("/accounts", async (request, response) => { 7 | try { 8 | const accounts = await accountModel.find({}); 9 | return response.json({ accounts }); 10 | } catch (error) { 11 | return response.status(500).json({ error: "erro ao listar as contas" }); 12 | } 13 | }); 14 | 15 | router.post("/accounts", async (request, response) => { 16 | try { 17 | const account = new accountModel(request.body); 18 | await account.save(); 19 | return response.json(account); 20 | } catch (error) { 21 | return response.status(500).json({ error }); 22 | } 23 | }); 24 | 25 | router.put("/accounts/:id", async (request, response) => { 26 | try { 27 | const account = await accountModel.findOneAndUpdate( 28 | { _id: request.params.id }, 29 | request.body, 30 | { new: true } 31 | ); 32 | if (!account) { 33 | return response.status(404).json({ error: "documento nao encontrado" }); 34 | } 35 | return response.json(account); 36 | } catch (error) { 37 | return response.status(500).json({ error }); 38 | } 39 | }); 40 | 41 | router.patch("/accounts/deposito", async (request, response) => { 42 | const { agencia, conta, valor } = request.body; 43 | try { 44 | const account = await accountModel.findOneAndUpdate( 45 | { agencia, conta }, 46 | { $inc: { balance: valor } }, 47 | { new: true } 48 | ); 49 | if (!account) { 50 | return response.status(404).json({ error: "conta nao encontrada" }); 51 | } 52 | return response.json({ saldoAtual: account.balance }); 53 | } catch (error) { 54 | return response.status(500).json({ error }); 55 | } 56 | }); 57 | 58 | router.patch("/accounts/saque", async (request, response) => { 59 | const { agencia, conta, valor } = request.body; 60 | try { 61 | let account = await accountModel.findOne({ agencia, conta }); 62 | if (account && account.balance >= valor + 1) { 63 | account = await accountModel.findOneAndUpdate( 64 | { agencia, conta }, 65 | { $inc: { balance: valor * -1 - 1 } }, 66 | { new: true } 67 | ); 68 | } else if (account) { 69 | return response.json({ msg: "saldo insuficiente para este saque" }); 70 | } 71 | if (!account) { 72 | return response.status(404).json({ error: "conta nao encontrada" }); 73 | } 74 | return response.json({ saldoAtual: account.balance }); 75 | } catch (error) { 76 | return response.status(500).json({ error }); 77 | } 78 | }); 79 | 80 | router.get("/accounts/saldo/:agencia/:conta", async (request, response) => { 81 | const { agencia, conta } = request.params; 82 | try { 83 | const account = await accountModel.findOne({ agencia, conta }); 84 | if (!account) { 85 | return response.status(404).json({ error: "conta nao encontrada" }); 86 | } 87 | return response.json({ saldoAtual: account.balance }); 88 | } catch (error) { 89 | return response.status(500).json({ error }); 90 | } 91 | }); 92 | 93 | router.delete("/accounts/:agencia/:conta", async (request, response) => { 94 | const { agencia, conta } = request.params; 95 | try { 96 | const account = await accountModel.findOneAndDelete({ agencia, conta }); 97 | if (!account) { 98 | return response.status(404).json({ error: "conta nao encontrada" }); 99 | } 100 | const accountQuantity = await accountModel.countDocuments({ agencia }); 101 | return response.json({ quantidade: accountQuantity }); 102 | } catch (error) { 103 | return response.status(500).json({ error }); 104 | } 105 | }); 106 | 107 | router.post("/accounts/transferencia", async (request, response) => { 108 | const { contaOrigem, contaDestino, valor } = request.body; 109 | let tarifa = 0; 110 | try { 111 | const accountOrigem = await accountModel.findOne({ conta: contaOrigem }); 112 | const accountDestino = await accountModel.findOne({ conta: contaDestino }); 113 | console.log(accountOrigem.agencia, tarifa); 114 | if (accountOrigem.agencia !== accountDestino.agencia) { 115 | tarifa = 8; 116 | } 117 | 118 | if (accountOrigem.balance < +valor + tarifa) { 119 | return response.json({ msg: "saldo insuficiente para transferencia" }); 120 | } 121 | 122 | const account = await accountModel.findOneAndUpdate( 123 | { conta: contaOrigem }, 124 | { $inc: { balance: valor * -1 - tarifa } }, 125 | { new: true } 126 | ); 127 | 128 | await accountModel.findOneAndUpdate( 129 | { conta: contaDestino }, 130 | { $inc: { balance: +valor } } 131 | ); 132 | 133 | return response.json({ saldoContaOrigem: account.balance }); 134 | } catch (error) { 135 | return response.status(500).json({ error }); 136 | } 137 | }); 138 | 139 | router.get("/accounts/media/:agencia", async (request, response) => { 140 | const { agencia } = request.params; 141 | try { 142 | const accounts = await accountModel.aggregate([ 143 | { 144 | $group: { 145 | _id: "$agencia", 146 | media: { 147 | $avg: "$balance", 148 | }, 149 | }, 150 | }, 151 | ]); 152 | const account = accounts.filter((account) => account._id === +agencia); 153 | return response.json({ media: account[0].media }); 154 | } catch (error) { 155 | return response.status(500).json({ error }); 156 | } 157 | }); 158 | 159 | router.get("/accounts/menores/:quantidade", async (request, response) => { 160 | const { quantidade } = request.params; 161 | try { 162 | const accounts = await accountModel 163 | .find({}) 164 | .sort({ balance: 1 }) 165 | .limit(+quantidade); 166 | return response.json(accounts); 167 | } catch (error) { 168 | return response.status(500).json({ error }); 169 | } 170 | }); 171 | 172 | router.get("/accounts/maiores/:quantidade", async (request, response) => { 173 | const { quantidade } = request.params; 174 | try { 175 | const accounts = await accountModel 176 | .find({}) 177 | .sort({ balance: -1 }) 178 | .limit(+quantidade); 179 | return response.json(accounts); 180 | } catch (error) { 181 | return response.status(500).json({ error }); 182 | } 183 | }); 184 | 185 | export { router }; 186 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootcamp-fullstack-igti", 3 | "version": "1.0.0", 4 | "description": "Projetos desenvolvidos no bootcamp fullstack da IGTI", 5 | "main": "./fundamentos/trabalho-pratico/projeto/js/script.js", 6 | "scripts": { 7 | "dev-fundamentos-trabalho-pratico": "babel ./fundamentos/trabalho-pratico/projeto/js/script.js -o ./fundamentos/trabalho-pratico/projeto/js/script-babel.js", 8 | "dev-fundamentos-desafio": "babel ./fundamentos/desafio/projeto/js/script.js -o ./fundamentos/desafio/projeto/js/script-babel.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/testtzlaffe/bootcamp-fullstack-igti.git" 13 | }, 14 | "author": "Christian Alpoim", 15 | "license": "ISC", 16 | "bugs": { 17 | "url": "https://github.com/testtzlaffe/bootcamp-fullstack-igti/issues" 18 | }, 19 | "homepage": "https://github.com/testtzlaffe/bootcamp-fullstack-igti#readme", 20 | "dependencies": { 21 | "@babel/cli": "^7.8.4", 22 | "@babel/core": "^7.9.6", 23 | "@babel/preset-env": "^7.9.6" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /react/desafio/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 |

Bootcamp Full Stack

31 |

ReactJS: Desafio

32 |
33 |
34 |
35 |

36 | O objetivo desta aplicação é calcular parcelas de juros compostos 37 | baseadas nos inputs de capital inicial, taxa de juros e quantidade de 38 | parcelas. 39 |

40 |

41 | Este foi o desafio que mais gostei até o momento neste bootcamp. É 42 | muito prazeroso programar usando ReactJS. 43 |

44 |

45 | Aqui nesta aplicação, construí todos os componentes baseados em 46 | funções. Utilizei useState e useEffect, que tornaram o desenvolvimento 47 | muito mais ágil. 48 |

49 | 54 | 58 | 61 | 62 |
63 |
64 | 65 | 66 | -------------------------------------------------------------------------------- /react/desafio/projeto/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /react/desafio/projeto/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `yarn start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `yarn test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `yarn build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `yarn eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `yarn build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /react/desafio/projeto/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "projeto", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^4.2.4", 7 | "@testing-library/react": "^9.3.2", 8 | "@testing-library/user-event": "^7.1.2", 9 | "react": "^16.13.1", 10 | "react-dom": "^16.13.1", 11 | "react-scripts": "3.4.1" 12 | }, 13 | "scripts": { 14 | "start": "react-scripts start", 15 | "build": "react-scripts build", 16 | "test": "react-scripts test", 17 | "eject": "react-scripts eject" 18 | }, 19 | "eslintConfig": { 20 | "extends": "react-app" 21 | }, 22 | "browserslist": { 23 | "production": [ 24 | ">0.2%", 25 | "not dead", 26 | "not op_mini all" 27 | ], 28 | "development": [ 29 | "last 1 chrome version", 30 | "last 1 firefox version", 31 | "last 1 safari version" 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /react/desafio/projeto/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/react/desafio/projeto/public/favicon.ico -------------------------------------------------------------------------------- /react/desafio/projeto/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /react/desafio/projeto/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/react/desafio/projeto/public/logo192.png -------------------------------------------------------------------------------- /react/desafio/projeto/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/react/desafio/projeto/public/logo512.png -------------------------------------------------------------------------------- /react/desafio/projeto/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /react/desafio/projeto/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /react/desafio/projeto/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /react/desafio/projeto/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import "./App.css"; 3 | import Form from "./components/Form/Form"; 4 | import Installments from "./components/Installments/Installments"; 5 | 6 | function App() { 7 | const [initialValue, setInitialValue] = useState(0); 8 | const [interestRate, setInterestRate] = useState(0); 9 | const [months, setMonths] = useState(1); 10 | const [installments, setInstallments] = useState([]); 11 | 12 | useEffect(() => { 13 | let localInstallments = []; 14 | 15 | for (let i = 1; i <= months; i++) { 16 | const percent = (Math.pow(1 + interestRate / 100, i) - 1) * 100; 17 | const increment = ( 18 | initialValue * (1 + percent / 100) - 19 | initialValue 20 | ).toFixed(2); 21 | const value = (parseFloat(initialValue) + parseFloat(increment)).toFixed( 22 | 2 23 | ); 24 | 25 | localInstallments.push({ 26 | month: i, 27 | value, 28 | increment, 29 | percent, 30 | }); 31 | } 32 | 33 | setInstallments(localInstallments); 34 | }, [initialValue, interestRate, months]); 35 | 36 | const handleChangeInitialValue = (event) => { 37 | setInitialValue(event.target.value); 38 | }; 39 | 40 | const handleChangeInterestRate = (event) => { 41 | setInterestRate(event.target.value); 42 | }; 43 | 44 | const handleChangeMonths = (event) => { 45 | setMonths(event.target.value); 46 | }; 47 | 48 | return ( 49 |
50 |
58 | 59 | 60 |
61 | ); 62 | } 63 | 64 | export default App; 65 | -------------------------------------------------------------------------------- /react/desafio/projeto/src/components/Form/Form.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function Form({ values, handlers }) { 4 | const { initialValue, interestRate, months } = values; 5 | const { 6 | handleChangeInitialValue, 7 | handleChangeInterestRate, 8 | handleChangeMonths, 9 | } = handlers; 10 | 11 | return ( 12 |
13 | 14 |
15 |

16 | 19 |

20 | 27 |
28 |
29 |

30 | 33 |

34 | 41 |
42 |
43 |

44 | 47 |

48 | 55 |
56 | 57 |
58 | ); 59 | } 60 | 61 | const styles = { 62 | label: { 63 | fontSize: "0.8rem", 64 | }, 65 | 66 | input: { 67 | height: "20px", 68 | width: "50%", 69 | maxWidth: "300px", 70 | }, 71 | }; 72 | -------------------------------------------------------------------------------- /react/desafio/projeto/src/components/Installments/Installment/Installment.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function Installment({ values }) { 4 | const { month, value, increment, percent } = values; 5 | return ( 6 |
7 |
{month}
8 |
M: {value}
9 |
10 | {increment > 0 ? "+" : null} 11 | {increment} 12 |
13 |
{percent.toFixed(2)}%
14 |
15 | ); 16 | } 17 | 18 | const styles = { 19 | card: { 20 | border: "1px solid #ccc", 21 | margin: "2px", 22 | borderRadius: "4px", 23 | padding: "4px", 24 | minWidth: "100px", 25 | }, 26 | 27 | month: { 28 | fontSize: "0.7rem", 29 | backgroundColor: "#ccc", 30 | borderRadius: "4px", 31 | color: "white", 32 | padding: "2px", 33 | }, 34 | 35 | element: { 36 | marginTop: "5px", 37 | }, 38 | }; 39 | -------------------------------------------------------------------------------- /react/desafio/projeto/src/components/Installments/Installments.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Installment from "./Installment/Installment"; 3 | 4 | export default function Installments({ installments }) { 5 | const installmentsList = installments.map((installment) => { 6 | const { month } = installment; 7 | return ; 8 | }); 9 | 10 | return
{installmentsList}
; 11 | } 12 | 13 | const styles = { 14 | container: { 15 | display: "flex", 16 | flexWrap: "wrap", 17 | justifyContent: "center", 18 | marginTop: "30px", 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /react/desafio/projeto/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /react/desafio/projeto/src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import "./index.css"; 4 | import App from "./App"; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById("root") 11 | ); 12 | -------------------------------------------------------------------------------- /react/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 | 31 |

Bootcamp Full Stack

32 |

ReactJS

33 |
34 |
35 |
36 |

37 | Neste módulo foram apresentados os conceitos do ReactJS para 38 | construção de interfaces. Inicialmente criamos componentes baseados em 39 | classes de JavaScript. No segundo momento, transformamos todas as 40 | classes em functional components. 41 |

42 | 43 |

44 | Realizamos algumas integrações com o back-end e foi possível entender 45 | o poder do React no front-end, e visualizar como é bem performático. 46 |

47 | 48 |

49 | Abaixo, segue o trabalho prático com componentes usando classes e o 50 | desafio com React Hooks. 51 |

52 |
53 |
54 |
55 |
56 |
Salary Calculations
57 |
Trabalho Prático
58 |

59 | ReactJS baseado em classes. 60 |

61 | Detalhes 62 |
63 |
64 |
65 |
66 |
Compound Interest
67 |
Desafio
68 |

69 | ReactJS baseado em funções. 70 |

71 | Detalhes 72 |
73 |
74 |
75 |
76 | 77 | 78 | -------------------------------------------------------------------------------- /react/trabalho-pratico/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Bootcamp Full Stack 7 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 24 | 29 |
30 |

Bootcamp Full Stack

31 |

ReactJS: Trabalho Prático

32 |
33 |
34 |
35 |

36 | Esta aplicação calcula algumas rubricas sobre salário. Neste projeto, 37 | os componentes são baseados em classes, e foi possível utilizar os 38 | conceitos de estado e props. 39 |

40 | 41 | 46 | 50 | 53 | 54 |
55 |
56 | 57 | 58 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `yarn start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `yarn test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `yarn build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `yarn eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `yarn build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-salario", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^4.2.4", 7 | "@testing-library/react": "^9.3.2", 8 | "@testing-library/user-event": "^7.1.2", 9 | "react": "^16.13.1", 10 | "react-dom": "^16.13.1", 11 | "react-scripts": "3.4.1" 12 | }, 13 | "scripts": { 14 | "start": "react-scripts start", 15 | "build": "react-scripts build", 16 | "test": "react-scripts test", 17 | "eject": "react-scripts eject" 18 | }, 19 | "eslintConfig": { 20 | "extends": "react-app" 21 | }, 22 | "browserslist": { 23 | "production": [ 24 | ">0.2%", 25 | "not dead", 26 | "not op_mini all" 27 | ], 28 | "development": [ 29 | "last 1 chrome version", 30 | "last 1 firefox version", 31 | "last 1 safari version" 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/react/trabalho-pratico/projeto/public/favicon.ico -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/react/trabalho-pratico/projeto/public/logo192.png -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testtzlaffe/bootcamp-fullstack-igti/82b698ecdd37a3a5307bbcc6f97dafc4487eaff3/react/trabalho-pratico/projeto/public/logo512.png -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import "./App.css"; 3 | import InputFullSalary from "./Components/InputFullSalary/InputFullSalary"; 4 | import InputReadOnly from "./Components/InputReadOnly/InputReadOnly"; 5 | import ProgressBarSalary from "./Components/ProgressBarSalary/ProgressBarSalary"; 6 | import { calculateSalaryFrom } from "./SalaryCalculations/salary"; 7 | 8 | class App extends Component { 9 | state = { 10 | fullSalary: 0, 11 | }; 12 | 13 | handleChangeInput = (event) => { 14 | this.setState({ fullSalary: event.target.value }); 15 | }; 16 | 17 | render() { 18 | const { fullSalary } = this.state; 19 | 20 | const { 21 | baseINSS, 22 | discountINSS, 23 | baseIRPF, 24 | discountIRPF, 25 | netSalary, 26 | inssPercent, 27 | irpfPercent, 28 | netSalaryPercent, 29 | } = calculateSalaryFrom(fullSalary); 30 | 31 | return ( 32 |
33 | 34 | 41 | 46 |
47 | ); 48 | } 49 | } 50 | 51 | export default App; 52 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | const { getByText } = render(); 7 | const linkElement = getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/Components/InputFullSalary/InputFullSalary.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | 3 | export default class InputFullSalary extends Component { 4 | render() { 5 | const { change } = this.props; 6 | return ( 7 |
8 | 14 |
15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/Components/InputReadOnly/Input/Input.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | 3 | export default class Input extends Component { 4 | render() { 5 | const { value, type } = this.props; 6 | return ( 7 |
8 | 9 | 10 |
11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/Components/InputReadOnly/InputReadOnly.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import Input from "./Input/Input"; 3 | 4 | export default class InputReadOnly extends Component { 5 | render() { 6 | const { 7 | baseINSS, 8 | discountINSS, 9 | baseIRPF, 10 | discountIRPF, 11 | netSalary, 12 | } = this.props; 13 | 14 | return ( 15 |
16 | 17 | 18 | 19 | 20 | 21 |
22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/Components/ProgressBarSalary/ProgressBarSalary.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | 3 | export default class ProgressBarSalary extends Component { 4 | render() { 5 | const { inssPercent, irpfPercent, netSalaryPercent } = this.props; 6 | 7 | const styles = { 8 | bar: { 9 | display: "flex", 10 | }, 11 | 12 | primeiro: { 13 | backgroundColor: "red", 14 | width: `${inssPercent}%`, 15 | }, 16 | 17 | segundo: { 18 | backgroundColor: "orange", 19 | width: `${irpfPercent}%`, 20 | }, 21 | terceiro: { 22 | backgroundColor: "green", 23 | width: `${netSalaryPercent}%`, 24 | }, 25 | }; 26 | 27 | return ( 28 |
29 |
INSS
30 |
IRPF
31 |
NetSalary
32 |
33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/SalaryCalculations/salary.js: -------------------------------------------------------------------------------- 1 | // Fonte: https://www.todacarreira.com/calculo-salario-liquido/ 2 | 3 | const INSS_TABLE = [ 4 | { 5 | id: 1, 6 | minValue: 0, 7 | maxValue: 1045, 8 | difference: 1045 - 0, 9 | discountPercentage: 0.075, 10 | discountValue: -1, 11 | }, 12 | { 13 | id: 2, 14 | minValue: 1045.01, 15 | maxValue: 2089.6, 16 | difference: 2089.6 - 1045, 17 | discountPercentage: 0.09, 18 | }, 19 | { 20 | id: 3, 21 | minValue: 2089.61, 22 | maxValue: 3134.4, 23 | difference: 3134.4 - 2089.6, 24 | discountPercentage: 0.12, 25 | }, 26 | { 27 | id: 4, 28 | minValue: 3134.41, 29 | maxValue: 6101.06, 30 | difference: 6101.06 - 3134.4, 31 | discountPercentage: 0.14, 32 | }, 33 | ]; 34 | 35 | function round(value) { 36 | return +value.toFixed(2); 37 | } 38 | 39 | function calculateDiscountINSS(baseINSS) { 40 | let discountINSS = 0; 41 | 42 | if (baseINSS > 6101.07) { 43 | return 713.1; 44 | } 45 | 46 | for (var i = 0; i < INSS_TABLE.length; i++) { 47 | var currentItem = INSS_TABLE[i]; 48 | let discountValue = 0; 49 | 50 | if (baseINSS > currentItem.maxValue) { 51 | // prettier-ignore 52 | discountValue = 53 | round(currentItem.difference * currentItem.discountPercentage); 54 | 55 | discountINSS += discountValue; 56 | } else { 57 | // prettier-ignore 58 | discountValue = 59 | round((baseINSS - currentItem.minValue) * currentItem.discountPercentage); 60 | 61 | discountINSS += discountValue; 62 | break; 63 | } 64 | } 65 | 66 | discountINSS = round(discountINSS); 67 | 68 | return discountINSS; 69 | } 70 | 71 | function calculateDiscountIRPF(baseIRPF) { 72 | let discountIRPF = 73 | baseIRPF < 1903.98 74 | ? 0 75 | : baseIRPF < 2826.65 76 | ? round(baseIRPF * 0.075) - 142.8 77 | : baseIRPF < 3751.05 78 | ? round(baseIRPF * 0.15) - 354.8 79 | : baseIRPF < 4664.68 80 | ? round(baseIRPF * 0.225) - 636.13 81 | : round(baseIRPF * 0.275) - 869.36; 82 | 83 | discountIRPF = round(discountIRPF); 84 | 85 | return discountIRPF; 86 | } 87 | 88 | function calculateSalaryFrom(fullSalary) { 89 | const baseINSS = fullSalary; 90 | const discountINSS = calculateDiscountINSS(baseINSS); 91 | 92 | const baseIRPF = baseINSS - discountINSS; 93 | const discountIRPF = calculateDiscountIRPF(baseIRPF); 94 | 95 | const netSalary = baseINSS - discountINSS - discountIRPF; 96 | 97 | const inssPercent = fullSalary > 0 ? (discountINSS / fullSalary) * 100 : 0; 98 | const irpfPercent = fullSalary > 0 ? (discountIRPF / fullSalary) * 100 : 0; 99 | const netSalaryPercent = fullSalary > 0 ? (netSalary / fullSalary) * 100 : 0; 100 | 101 | return { 102 | baseINSS, 103 | discountINSS, 104 | baseIRPF, 105 | discountIRPF, 106 | netSalary, 107 | inssPercent, 108 | irpfPercent, 109 | netSalaryPercent, 110 | }; 111 | } 112 | 113 | export { calculateSalaryFrom }; 114 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | // If you want your app to work offline and load faster, you can change 15 | // unregister() to register() below. Note this comes with some pitfalls. 16 | // Learn more about service workers: https://bit.ly/CRA-PWA 17 | serviceWorker.unregister(); 18 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.0/8 are considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl, { 104 | headers: { 'Service-Worker': 'script' }, 105 | }) 106 | .then(response => { 107 | // Ensure service worker exists, and that we really are getting a JS file. 108 | const contentType = response.headers.get('content-type'); 109 | if ( 110 | response.status === 404 || 111 | (contentType != null && contentType.indexOf('javascript') === -1) 112 | ) { 113 | // No service worker found. Probably a different app. Reload the page. 114 | navigator.serviceWorker.ready.then(registration => { 115 | registration.unregister().then(() => { 116 | window.location.reload(); 117 | }); 118 | }); 119 | } else { 120 | // Service worker found. Proceed as normal. 121 | registerValidSW(swUrl, config); 122 | } 123 | }) 124 | .catch(() => { 125 | console.log( 126 | 'No internet connection found. App is running in offline mode.' 127 | ); 128 | }); 129 | } 130 | 131 | export function unregister() { 132 | if ('serviceWorker' in navigator) { 133 | navigator.serviceWorker.ready 134 | .then(registration => { 135 | registration.unregister(); 136 | }) 137 | .catch(error => { 138 | console.error(error.message); 139 | }); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /react/trabalho-pratico/projeto/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | --------------------------------------------------------------------------------