Skip to content

Instantly share code, notes, and snippets.

@michaelnagy
Created June 5, 2018 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelnagy/c06fefd83357be3a2f4eb2a9e0228cef to your computer and use it in GitHub Desktop.
Save michaelnagy/c06fefd83357be3a2f4eb2a9e0228cef to your computer and use it in GitHub Desktop.
proxy-server-nodejs
server.put('/auth/v1/alterar-senha', async (req, res) => {
console.log('TOKEN from server: ', req.cookies.access_token)
const response = await fetch('yourputurl.com', {
method: 'PUT',
headers: {
token: req.cookies.access_token,
authorization: 'Basic Q3asdasdasdbGllbnQ6ZW9CWDYxaWcasdasVaRHpH',
'content-type': 'application/json'
},
body: JSON.stringify({ nova: 'oldpass', antiga: 'newpass' })
})
console.log('response from server', response)
const result = await response.text()
console.log('response from server JSON', result)
res.send(result).status(response.status)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment