Skip to content

Instantly share code, notes, and snippets.

@tosipaulo
Created July 19, 2017 20:59
Show Gist options
  • Save tosipaulo/913d6d0c12b0d019100391b5d675d065 to your computer and use it in GitHub Desktop.
Save tosipaulo/913d6d0c12b0d019100391b5d675d065 to your computer and use it in GitHub Desktop.
Exercício 6
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)})
@tuliofaria
Copy link

Certinho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment