Daemon Server

This behavior is designed to extend, the basic Livecode Server Daemon, to serve Fedwiki Files. This behavior inherits the Livecode Daemon behavior script.

A minimal library for creating simple HTTP and Restful servers using Livecode. It should contain only code that is absolutle necessary - and is optimised for speed. Another aim of this library is that it should be able to run a server, without any additional code using only custom properties of an object that it is attached to as a behavior. All othere messages (if any are needed) would be dispatched and optional) Logging and similar functions are added using before/after middleware handlers. Not sure yet what to do as a default routing behavior.

You dont have to use separate middleware. You can put these "before" and "after" handlers anywhere in the behavior_Hirarchy They work as middleware wherever they are. They only get called once ( though it should work to be called twice if you try passing them - not tested). This script is designed to be a behavior for a Live Daemon server. By default it should be a behavior of the Daemon Server stack. So the hiierarchy goes: server stack => lib_DaemonMiddleware => lib_DaemonRouter => lib_DaemonServer => lib_DaemonLog => lib_Log However this hiierarchy can be altered using "server_SetBehaviorHierarchy" in the server stack, which will override the handler of the same name in the lib_DaemonServer stack.

getprop daemon_Server /* This is the control (often a stack) that is an instance of a particular server. Attached to this object is a chain of behaviors that implement the generic daemon server functionality. You customise the server by: 1) Adding scripts to the daemon_Server 2) Dropping in on wrting your own custom daemon_RouterLibrary 3) Messing with the behavior_Hierarchy of the daemon_Server */ return DaemonServer end daemon_Server