I wish to have a JavaScript running under node.js post a form to a Photon’s function to activate it and return a status. Can someone document an example of all the lines sent via HTTP that would call a photon function called “photon-function”. I have used curl to verify that the photon function is working properly from a call from a remote site. But I am not sure what the format of the header and body should be so I can have the JavaScript create that format.
Any reason against using the javascript SDK, which was made to do these exact things?
https://docs.particle.io/reference/javascript/#callfunction
There's always this (amazing) tutorial if you're keen on doing it manually:
Considering you're suing Node.js, and there's a library written for it, I'd suggest using that though...
2 Likes