I'm trying to send parameter to nodejs with restify, but it's always getting undefined
I'm sending more or less like this:
$.ajax({
url : 'http://localhost:8080/api',
type: 'post',
dataType: 'json',
data: {
ano : ano
}
})
And on the node I'm getting like this:
server.post('/api/temp/anual', async (req, res, next) =>{
try{
const { ano } = req.params
console.log( ano )
res.send( await db.medicao().anual( ano ) )
next()
}catch (error) {
res.send(error)
next()
}
})
Only the value always comes as undefined
If I try for postman it's okay