Created
July 19, 2017 20:59
-
-
Save tosipaulo/913d6d0c12b0d019100391b5d675d065 to your computer and use it in GitHub Desktop.
Exercício 6
This file contains 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', (request, response) => { | |
let soma = 0; | |
if(request.query && request.query.num1 && request.query.num2){ | |
soma = parseInt(request.query.num1) + parseInt(request.query.num2) | |
} | |
response.send('A soma é: ' + soma) | |
}) | |
app.listen(port, () => { console.log("Servidor rodando na porta:" + 3000)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certinho