This server is written by almost pure Wolfram Language for heuristic purposes.
This server is inspired by wolfram-server but attempts to give a more complicated application of built-in functions for web development.
I may update this code in the future. And you can feel free to submit PRs if you created some applications which meet common requirements.
Start a SocketListener
with user-defined configuration. Print some useful message.
HTTPRespond
: Process socket data, print a log string and then close clientSocketObject
. The default response is decided byWolframServerService`$MainURLDispatcher
.
$MainURLDispatcher
: The default URLs dispatcher which dispatch URL to$IndexService
,$ServiceDispatcher
(Web Service),$APIDispatcher
(JSON Response), aGetResource
function which meets requirements for files and a dispatcher inWolframServerUserService.wl
.
ToMIME
: Convert file format postfixes to MIME type strings. It works forWolframServerService`GetResource
to provideHTTPResponse[<|"ContentType" -> "MIMEType"|>]
. Not finished yet.ResourceLocalize
: Replace the resources link to wolframcloud.com by local link. It works forWolframServerService`GetResource
.ApacheLog
: Give an Apache-style log. Not a complete function yet.MakeFormRules
: Convert body bytes in theHTTPRequest
received to an association. It works forFormFunction
which requiresHTTPRequestData["FormRules"]
.
ServerShutdown
ServerStart
ServerMonitor
: Hold the main loop to forbid process to exit. It works for StartServer.wls in the command line environment.ShowLog
: Import the log file in the server directory as a string. The default log file is "nohup.out".
There is a simple note service implemented, which is a string list that can be operated by the web UI provided by some FormFunction
s.
Send a request to the root path of local host on port 8080.
Copy cloud resources to be localized from Wolfram Engine's installation directory. It works for WolframServerTool`ResourceLocalize
.
- To provide services to users as a server, you need a proper license.
- There's no security features implemented in
WolframServerService`EvaluationService
. Users can evaluate anything. Possible expressions includesRunProcess
,Quit
etc..