You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.6 KiB
1.6 KiB
Scriptform Developer guide
Build rules
Build rules for testing, generating documentation and generating packages are
stored in build.sla
. These can be run directly from a POSIX compliant shell,
or you can use the Simple Little Automator
for convenience.
Inner workings
- Instantiate a
ScriptForm
class. This takes care of loading the form config (json) file and provides methods to run the server. - If running as a daemon:
a) Instantiate the
Daemon
class b) Hook up a callback to shutdown the ScriptForm server c) Start the daemon. This detaches from the console. - Start the ScriptForm server. This listens on a port for incoming HTTP connections.
- If a request comes in, it is dispatched to the
ScriptFormWebApp
request handler.ScriptFormWebApp
inherits from thewebserver.RequestHandler
class. TheWebAppHandler
determines which method ofScriptFormWebApp
the request should be dispatched to. - Depending on the request, a method is called on
ScriptFormWebApp
. These methods render HTML to as a response. - If a form is submitted, its fields are validated and the script callback is called. Depending on the output type, the output of the script is either captured and displayed as HTML to the user or directly streamed to the browser.
- GOTO 4.
- Upon receiving an OS signal (kill, etc) the daemon calls the shutdown callback.
- The shutdown callback starts a new thread (otherwise the webserver blocks until the next request) to stop the server.
- The program exits.