Created
December 16, 2018 18:05
-
-
Save mikepfeiffer/088fb749d9f26b688b4032205c918fdb to your computer and use it in GitHub Desktop.
Default HttpTrigger Code Sample for Azure Function (JavaScript)
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 = async 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" | |
}; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment