Last active
November 7, 2018 05:52
-
-
Save milannankov/00b94cd2a854efb4b632e8ecd31f2a82 to your computer and use it in GitHub Desktop.
Serverless Backend for Data Transformation (Part 1) - index.js
This file contains hidden or 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 = 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