Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@adnanrahic
Last active May 9, 2018 08:02
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 adnanrahic/8e0ddd50e5e9197ad9ca4028c295381e to your computer and use it in GitHub Desktop.
Save adnanrahic/8e0ddd50e5e9197ad9ca4028c295381e to your computer and use it in GitHub Desktop.
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