Created
July 19, 2017 12:59
-
-
Save marcaosi/0c39b4ca4974cd5c004a86b692cec515 to your computer and use it in GitHub Desktop.
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 num1 = request.query.num1 | |
let num2 = request.query.num2 | |
if(num1 && num2){ | |
let soma = (parseInt(num1) + parseInt(num2)) | |
response.send('A soma eh: ' + soma) | |
}else{ | |
response.send('Por favor, preciso de dois parâmetros para executar.') | |
} | |
}) | |
app.listen(port, () => console.log('Server running now')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment