Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Deploy an expression to a local web server
ResourceFunction["WebServerDeploy"][expr] deploys expr to a local web server. | |
ResourceFunction["WebServerDeploy"][expr,loc] deploys expr to the address or port specified by loc. |
HandlerFunctions | <||> | how to handle events generated |
HandlerFunctionsKeys | Automatic | what parameters to supply to handler functions |
"HTTPRequestReceived" | request received |
"HTTPResponseSent" | response sent |
"HTTPRequest" | the HTTPRequest |
"HTTPResponse" | the HTTPResponse |
Deploy a web server hosting a simple API:
In[1]:= | ![]() |
Out[1]= | ![]() |
Make a request to the API:
In[2]:= | ![]() |
Out[2]= | ![]() |
In[3]:= | ![]() |
Out[3]= | ![]() |
Stop the web server:
In[4]:= | ![]() |
Deploy a simple website with pages and APIs:
In[5]:= | ![]() |
Out[5]= | ![]() |
The root page is a 404:
In[6]:= | ![]() |
Out[6]= | ![]() |
The homepage and API load at their respective paths:
In[7]:= | ![]() |
Out[7]= | ![]() |
In[8]:= | ![]() |
Out[8]= | ![]() |
Open the root page in a browser:
In[9]:= | ![]() |
Close the web server:
In[10]:= | ![]() |
Deploy a webserver to a specific port:
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
Close the web server:
In[13]:= | ![]() |
Deploy an API that modifies local state:
In[14]:= | ![]() |
In[15]:= | ![]() |
Out[15]= | ![]() |
Make calls to the web server:
In[16]:= | ![]() |
Out[16]= | ![]() |
In[17]:= | ![]() |
Out[17]= | ![]() |
The local state has been modified:
In[18]:= | ![]() |
Out[18]= | ![]() |
Close the web server:
In[19]:= | ![]() |
Use HandlerFunctions to add logging to a web server:
In[20]:= | ![]() |
In[21]:= | ![]() |
Out[21]= | ![]() |
Make requests:
In[22]:= | ![]() |
View the request logs:
In[23]:= | ![]() |
Out[23]= | ![]() |
Close the web server:
In[24]:= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License