public async Task<dynamic> Invoke(dynamic input) { // echo input message await doSomething(input.message); }
Returning data is not trivial, however, because any kind of complex object I tried to return caused unreported exceptions.
Until now!
It turns out that Edge .js returns associative arrays if and only if they're correctly JSON formatted. I don't recall seeing this documented anywhere, but it makes perfect sense (20/20 hindsight). So in order to return an associative array to Node.js, make sure to use a Dictionary object where the first element type is a string; if you want to send a list of usernames with their IDs, for example, you would either use
Dictionary<string, string>
with the ID cast to string for transmission or
Dictionary<string, int>
with the ID / username columns switched from their normal positions.
Of course, one could go about creating more intricate objects using the dynamic type, but that's beyond the scope of this post.