Skip to content

Instantly share code, notes, and snippets.

@kauemurakami
Created June 1, 2020 18:10
Show Gist options
  • Save kauemurakami/5f59a8e614d7347e2725f4222e50c5cd to your computer and use it in GitHub Desktop.
Save kauemurakami/5f59a8e614d7347e2725f4222e50c5cd to your computer and use it in GitHub Desktop.
atualizando registro
export const updateUser = async (req: Request, res: Response) => {
const body = await req.body()
if (Client.select('id', '===', req.params.id)) {
await Client.where('id', req.params.id).update({ name: body.value.name, email: body.value.email })
res.status(200).send({ clients: Client.all() })
}else{
res.status(404).send({ message: "usuário não encontrado" })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment