Get started
Import the latest packages from GitHub
Import["https://raw.githubusercontent.com/JerryI/tinyweb-mathematica/master/Tinyweb/Tinyweb.wl"]
Import["https://raw.githubusercontent.com/JerryI/tinyweb-mathematica/master/WSP/WSP.wl"]
Create the initial structure of the project. The default extension is .wsp
-- yourproject.nb or yourscript.wls
-- public/
-- -- index.wsp
To create the simplest server - use functions
server = WEBServer["addr" -> "127.0.0.1:80",
"path" -> NotebookDirectory[] <> "public", "socket-close" -> True]
server // WEBServerStart
Note: the parameter "socket-close" stands for the behavior when the response was sent. "True" means it will be closed, False - collected to the garbage and after a few iterations will be closed. It can prevent connection issues on some Windows machines, because of a bug in TCP library (the connection closes before the whole data has sent).
To stop the server - use
server // WEBServerStop