Minimal functor to turn awful websites into standalone programs: awful-main

This module allows you to quickly turn your awful web applications into static executables.

You instantiate the (awful main) functor with a module providing a run thunk and implement the awful web application inside the thunk.

This can be done using two separate modules:

; site.scm
(module site (run)
  (import scheme awful)
  (define (run)
    (define-page
      (main-page-path)
      (lambda ()
        (set-page-title! "awful-main example")
        "Hi, I'm using awful-main!")))
)
; main.scm
(import (awful main) site)
(module main = ((awful main) site))

... or with a single in-line functor instantiation:

; main.scm
(import (awful main))
(module main = (awful main)
  (import scheme awful)
  (define (run)
    (page-css (string-append (app-root-path) "css.css"))
    (define-page
      (main-page-path)
      (lambda ()
        (set-page-title! "awful-main example")
        "Hi, I'm using awful-main!")))
)

You then build your site as a static executable with csm -static -program main.

The generated main program can be invoked with the following arguments, where <root> is the directory containing the main program.

-user       user          User to run the website as
-addr       <ip-addr>     Bind to <ip-addr>              default: 127.0.0.1
-port       <port-num>    Bind to <port-num>             default: 8080
-access-log <path>        Enable access log to <path>    default: <root>/access.log
-debug-log  <path>        Enable debug log to <path>     default: disabled
-error-log  <path>        Enable error log to <path>     default: <root>/error.log
-web-root   <path>        Path to the web-root           default: <root>/static
-dev                      Start awful in dev mode        default: false

See the example directory.