Group Abstract Group Abstract

Message Boards Message Boards

[LiVE] Building Wolfram Cloud APIs to JS Frontends and Serverless Backends

Live Coding Sessions

The four sessions work up to a mini-project in the last 40 minutes of session 4.

The links for session 4 are now included below. There are session links for TwitchTV and YouTube. In session 3 I examine how to rasterize arbitrary WL expressions that are neither Images nor Graphics. We also go over how to control ImageSize and AspectRatio to accommodate HTML requirements (or vis-a-versa).

Along with Andreas Lauschke and Alan Calvitti I've undertaken the following 'live coding' sessions along the line of APIs where WL is the computational end point. I will not walk-through the JavaScript environment setup (unless there is enough demand). All the needed bit’s and pieces are readily available with very good documentation.

TwitchTV: - Session 1 - Session 2 - Session 3 - Session 4 YouTube: - Session 1 - Session 2 - Session 3 - Session 4

I frequently say front-end and back-end environments overlook (or under appreciate) the computation-side. However, with a few development requirements the quant-side can deliver to the front-end folks exactly what they need and reduce the amount of processing logic in the front-end. It also conforms to the development team and code writing philosophy of separation of concerns and duties. This opens the door to more modular teams and code with easy to understand handshakes between components and teams.

All the Notebooks, JavaScript code, YouTube and TwitchTV links are in my GitHub repository.

We start with the most simple use of APIFunction[…] I can think of then step into use cases that confront simple issues, which if not understood upfront, can cause delays and frustration for one of more team members. We make API calls to external resources from inside APIFunction[…] and get and put data from and to Wolfram Cloud. We look at producing and returning exactly the structure of JSON needed by the JavaScript (front-end).

This is followed with a look at using APIFunction[…] with NodeJS (backend) building up to dealing with the dreaded CORS issues and look into some security issues.

Lastly, we will look at a few use cases for integrating to AWS resources.

I will update this post and my GitHub as we proceed.

9 Replies

I am fine fine with the POST method, but I wasn't successful. Can you offer a suggestion?

Thanks Michael

POSTED BY: Michael Johnston
POSTED BY: Michael Johnston

Hi there, this might help you:

https://reference.wolfram.com/language/ref/AllowedCloudParameterExtensions.html

This is the easiest way to do it, it's not using Body as JSON however. But if you are fine in sending the payload as POST encoded data and add the payload in one of the parameters, you can do that.

Let me know if that helps.

Riccardo

Good timing. I'll have a look at the URL and give you some feedback.
I recently notice https://reference.wolfram.com/language/WolframNotebookEmbedder/ and have been testing it. Just today I noticed the community post Wolfram Notebook Embedder https://community.wolfram.com/groups/-/m/t/1788578 released by Jan Poeschko. You can see my comments down the post - to summarize - I use ReactJS and NodeJS extensivly and I've always wanted a way for a React component (at arbitragy levels in the component tree) to be responcible for the creation and mangement of WL containers (full of WL goodies) so that React can be used to control and App state and render requriements such that when a WL container living in a React component is part of the render - well - let the magic happen.

Posted 6 years ago
POSTED BY: Jesse Dohmann

I happy you're enjoying and finding it useful. I can't wait to here what you have to say after the 4 vedio ;-)

This is an excellent and thorough exploration of Wolfram Language-as-backend design, which is a very powerful paradigm for when a FormFunction frontend doesn't quite cut it. I particularly enjoyed the discussion in session 3 of image sizing and formatting, which is a tricky problem I've dealt with several times and still haven't quite gotten the hang of!

Also, regarding IntegerName, I tried it with a Real and (despite its name) it seems to work:

In[1]:= IntegerName[-0.01]

Out[1]= "minus zero point zero one"
POSTED BY: Jesse Friedman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard