Skip to content

Instantly share code, notes, and snippets.

@emmiep
Created April 17, 2018 11:37
Show Gist options
  • Save emmiep/9cc30673f4a16c8ae7e222741490f817 to your computer and use it in GitHub Desktop.
Save emmiep/9cc30673f4a16c8ae7e222741490f817 to your computer and use it in GitHub Desktop.
Setting a status code with stdlib
const users = [
'stdlib'
];
/**
* A basic Hello World function
* @param {string} name Who you're saying hello to
* @returns {object.http}
*/
module.exports = async (name, context) => {
if (users.includes(name)) {
return {
statusCode: 200,
body: `Hello ${name}!`
};
} else {
return {
statusCode: 404,
body: 'No such user'
};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment