Created
June 5, 2018 01:14
-
-
Save michaelnagy/c06fefd83357be3a2f4eb2a9e0228cef to your computer and use it in GitHub Desktop.
proxy-server-nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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