Created
March 15, 2018 05:45
-
-
Save ajb413/47787bcc98ff1da8bbd0b3bcb9f88af3 to your computer and use it in GitHub Desktop.
Serverless Token Validation Microservice
This file contains 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
export default (request, response) => { | |
const vault = require('vault'); | |
let paramsObject = request.params; | |
return vault.get('myToken').then((token) => { | |
if (paramsObject.token === token) { | |
response.status = 200; | |
return response.send(); | |
} else { | |
response.status = 400; | |
return response.send(); | |
} | |
}).catch((err) => { | |
console.error(err); | |
response.status = 500; | |
return response.send(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment