Skip to content

Instantly share code, notes, and snippets.

@milannankov
Last active November 7, 2018 05:52
Show Gist options
  • Save milannankov/00b94cd2a854efb4b632e8ecd31f2a82 to your computer and use it in GitHub Desktop.
Save milannankov/00b94cd2a854efb4b632e8ecd31f2a82 to your computer and use it in GitHub Desktop.
Serverless Backend for Data Transformation (Part 1) - index.js
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
if (req.query.name || (req.body && req.body.name)) {
context.res = {
// status: 200, /** Defaults to 200 **/
body: "Hello " + (req.query.name || req.body.name)
};
}
else {
context.res = {
status: 400,
body: "Please pass a name on the query string or in the request body"
};
}
context.done();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment