Hi, I'm green to everything here, but I'm having trouble using something that (in my dumb head, at least) should work.
I do not wish to use 'import' as I do not wish my code to import from a link every time in case I am requesting a lot.
Whatever I try, after pasting the full or minified javascript into my Function ... I cannot reference the functions within that.
How do I use the code present in a block of Javascript in my Function App's code?
This is my code, where EliotDocument()
or .doThing()
are part of the code in 'PASTED_CODE_GOES_HERE' ... and as you can see, I'm modifying the boilerplate HTTP request:
PASTED_CODE_GOES_HERE
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
//const name = (req.query.name || (req.body && req.body.name));
const fileBase64 = req.body.fileContentBase64;
let ellyDoc = await EliotDocument(fileBase64);
let ellyDocDoThing = ellyDoc.doThing();
const yeahYeah = 'Some nonsense';
/*
const responseMessage = name
? "Hello, " + name + ". This HTTP triggered function executed successfully."
: "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.";
*/
context.res = {
// status: 200, /* Defaults to 200 */
"headers": {
"Content-Type": "application/json"
},
"body": {
"ellyData": yeahYeah
}
};
};
I have tried:
- Pasting (PASTED_CODE_GOES_HERE) as minified code above or below my module.exports bit
- Tried the same with the full code
- Tried with
EliotDocument()
and not .doThing()
- Similarly tried with only
.doThing()
...
... and it just 500s out with every request, either with a 'asdasda' on the EliotDocument, or a 'asdasda' on the .doThing() ... what do I do to use my code?
Yes, you can assume that the code I am pasting is actually legally re-usable and functioning javascript.
If you wish to pick an example from literally anywhere with which to assist me on this, please do so, and replace the EliotDocument()
and .doThing()
actions with representative ones from there. They are literally just made up examples.