# 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 (chicken base) (chicken format)) (define (run args) (let ((name (member "name" args))) (unless name (error "Required argument: name")) (define-page (main-page-path) (lambda () (set-page-title! "awful-main example") (sprintf "Hi, ~A, I'm using awful-main" (cadr name))))))) ``` ``` ; 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 (chicken base) (chicken format)) (define (run args) (let ((name (member "name" args))) (unless name (error "Required argument: name")) (define-page (main-page-path) (lambda () (set-page-title! "awful-main example") (sprintf "Hi, ~A, I'm using awful-main" (cadr name))))))) ``` 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 `` is the directory containing the `main` program. If {{-args}} is specified, any additional arguments are passed to the {{run}} function in the implementation. ``` -user user User to run the website as -addr Bind to default: 127.0.0.1 -port Bind to default: 8080 -access-log Enable access log to default: /access.log -debug-log Enable debug log to default: disabled -error-log Enable error log to default: /error.log -web-root Path to the web-root default: /static -dev Start awful in dev mode default: false -args Pass additional arguments to `run` ``` See the [example] directory. [awful]: http://wiki.call-cc.org/eggref/5/awful [example]: /dir?ci=trunk&name=example