Last active
May 9, 2018 08:02
-
-
Save adnanrahic/8e0ddd50e5e9197ad9ca4028c295381e to your computer and use it in GitHub Desktop.
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
module.exports.login = async (event, context) => { // Lambda is async! | |
try { | |
const db = await connectToDatabase(); | |
const session = await login(JSON.parse(event.body)); | |
return { | |
statusCode: 200, | |
body: JSON.stringify(session) | |
}; | |
} catch (error) { | |
console.error(error.stack); | |
return { | |
statusCode: 500, | |
body: JSON.stringify(error.message) | |
}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment