Skip to content

Instantly share code, notes, and snippets.

@imalchenko
Last active August 9, 2017 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imalchenko/a7ec31f0cce527cd7ec14f3cf1f629e5 to your computer and use it in GitHub Desktop.
Save imalchenko/a7ec31f0cce527cd7ec14f3cf1f629e5 to your computer and use it in GitHub Desktop.
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();
};
@imalchenko
Copy link
Author

Sample function for an Azure Function App. Used for this demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment