Created
January 19, 2018 16:41
-
-
Save ealsur/f008bba563c249883236fc185242dfda to your computer and use it in GitHub Desktop.
Azure Cosmos DB + Functions Cookbook - HTTP query nodejs
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) { | |
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