Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
9 changes: 9 additions & 0 deletions Md03_Dev_Back_end/Bloco21/21.1/conteudo001_export.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// brlValue.js
const brl = 5.37;

const usdToBrl = (valueInUsd) => valueInUsd * brl;

module.exports = {
brl,
usdToBrl,
};
4 changes: 4 additions & 0 deletions Md03_Dev_Back_end/Bloco21/21.1/conteudo001_import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const { brl, usdToBrl } = require('./conteudo001_export');

console.log(`Valor do dólar: ${brl}`); // Valor do dólar: 5.37
console.log(`10 dólares em reais: ${usdToBrl(10)}`); // 10 dólares em reais: 53.7
8 changes: 8 additions & 0 deletions Md03_Dev_Back_end/Bloco21/21.1/conteudo002.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// minha-aplicacao/index.js
const meuModulo = require('./meusmodulos'); //multiplos modulos locais em uma pasta(e exportados em index.js na pasta)
const fs = require('fs'); //modulo interno

console.log(meuModulo); // { funcionalidade1: [Function: funcionalidade1], funcionalidade2: [Function: funcionalidade2] }

meuModulo.funcionalidade1();
fs.readFileSync('./meuArquivo.txt');
8 changes: 8 additions & 0 deletions Md03_Dev_Back_end/Bloco21/21.1/hello-world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const readLine = require('readline-sync');

// console.log('Hello, world!');

const name = readLine.question("Qual é o seu nome? ");
const age = readLine.questionInt("Qual é sua idade? ");

console.log(`Hello, ${name}! You are ${age} years old!`);
15 changes: 15 additions & 0 deletions Md03_Dev_Back_end/Bloco21/21.1/hello-world/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "hello-world",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Conan Goodwin (conan_goodwin@hotmail.com)",
"license": "ISC",
"dependencies": {
"readline-sync": "^1.4.10"
}
}
1 change: 1 addition & 0 deletions Md03_Dev_Back_end/Bloco21/21.1/meuArquivo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
teste
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// meuModulo/funcionalidade-1.js

module.exports = function () {
console.log('funcionalidade1');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// meuModulo/funcionalidade-2.js

module.exports = function () {
console.log('funcionalidade2');
}
5 changes: 5 additions & 0 deletions Md03_Dev_Back_end/Bloco21/21.1/meusmodulos/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// meuModulo/index.js
const funcionalidade1 = require('./funcionalidade-1');
const funcionalidade2 = require('./funcionalidade-2');

module.exports = { funcionalidade1, funcionalidade2 };
Empty file.