forked from serverless/serverless
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made azure template boilerplate code consistent in serverless as per s…
- Loading branch information
Showing
1 changed file
with
14 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
'use strict'; | ||
|
||
module.exports.hello = function (context, req) { | ||
// Add any necessary telemetry to support diagnosing your function | ||
context.log('HTTP trigger occured!'); | ||
context.log('JavaScript HTTP trigger function processed a request.'); | ||
|
||
// Read properties from the incoming request, and respond as appropriate. | ||
const name = req.query.name || (req.body && req.body.name) || 'World'; | ||
context.done(null, { body: `Hello ${name}` }); | ||
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(); | ||
}; |