Last active
August 9, 2017 05:35
-
-
Save imalchenko/a7ec31f0cce527cd7ec14f3cf1f629e5 to your computer and use it in GitHub Desktop.
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 = function (context, req) { | |
context.log('JavaScript HTTP trigger function processed a request.'); | |
/* | |
This function simply returns messages as a JSON in response to any request | |
Definitely not what you would want to have in a production environment, but will suffice for the demo | |
Note the content-type header for 'application/json' | |
*/ | |
context.res = { | |
// status: 200, /* Defaults to 200 */ | |
body: {"messages": [ | |
{"id":1,"content":"Hello"}, | |
{"id":2,"content":"Serverless"}, | |
{"id":3,"content":"Azure"} | |
]}, | |
headers: { | |
'Content-Type': 'application/json' | |
} | |
}; | |
context.done(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample function for an Azure Function App. Used for this demo