Created
July 20, 2017 00:19
-
-
Save elyssonmr/e57c3c97ccd34e3ed0a4ded52d4ba8df to your computer and use it in GitHub Desktop.
Exercício 6
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', (request, response) => { | |
console.log(request.query) | |
let resultado = 0 | |
if(request.query && request.query.num1 && request.query.num2) { | |
resultado = parseInt(request.query.num1) + parseInt(request.query.num2) | |
} | |
response.send("A soma é: " + resultado) | |
}) | |
app.listen(port, () => console.log('Server running on ' + port)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Certinho