Skip to content

Instantly share code, notes, and snippets.

@ealsur
Created January 19, 2018 16:41
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 ealsur/f008bba563c249883236fc185242dfda to your computer and use it in GitHub Desktop.
Save ealsur/f008bba563c249883236fc185242dfda to your computer and use it in GitHub Desktop.
Azure Cosmos DB + Functions Cookbook - HTTP query nodejs
module.exports = function (context, req) {
var documents = context.bindings.documents;
var totalDocuments = documents.length;
context.log('Found '+ totalDocuments +' documents');
if(totalDocuments === 0){
context.res = {
status: 404,
body : "No documents found"
};
}
else {
context.res = {
body: documents
};
}
context.done();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment