This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const port = 3000 | |
app.get('/somar', (req, res) =>{ | |
const sum = parseInt(req.query.num1) + parseInt(req.query.num2) | |
res.send('A soma é: ' + sum) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const path = './' | |
const readdirPromise = (path) => { | |
return new Promise( ( resolve, reject ) => { | |
fs.readdir( path, ( err, files) => { | |
if ( err ) { | |
reject( err ) | |
}else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const path = './' | |
const readdirPromise = (path) => { | |
return new Promise( ( resolve, reject ) => { | |
fs.readdir( path, ( err, files) => { | |
if( err ) { | |
console.log('ocorreu um erro') | |
}else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const produtos = [ | |
{ | |
id: 1, | |
preco: 10.0, | |
qtd: 2 | |
}, | |
{ | |
id: 2, | |
preco: 10.0, | |
qtd: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const produtos = [ | |
{ | |
nome: 'Bicicleta', | |
preco: 1200.0 | |
}, | |
{ | |
nome: 'Capacete', | |
preco: 450.0 | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function multiplicacao($multiplicador,$multiplicando,$count) | |
{ | |
if ($count >= 1 ) | |
{ | |
echo " $multiplicador x $multiplicando = " . $multiplicador * $multiplicando . "<br>"; | |
return $multiplicador * multiplicacao($multiplicador,$multiplicador*$multiplicando,--$count); | |
} |
NewerOlder