Skip to content

Instantly share code, notes, and snippets.

@elyssonmr
Created July 20, 2017 00:19
Show Gist options
  • Save elyssonmr/e57c3c97ccd34e3ed0a4ded52d4ba8df to your computer and use it in GitHub Desktop.
Save elyssonmr/e57c3c97ccd34e3ed0a4ded52d4ba8df 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) => {
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))
@tuliofaria
Copy link

Certinho

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