== awful main [[toc:]] === Description This module allows you to quickly turn your [[/egg/awful|awful]] web applications into static executables. === Author Pietro Cerutti === Repository [[https://code.ptrcrt.ch/awful-main|https://code.ptrcrt.ch/awful-main]] == Requirements * [[/egg/awful|awful]] * [[/egg/spiffy|spiffy]] * [[/egg/define-options|define-options]] == API === Instantiation This module exposes a single functor, {{awful main}}, which is instantiated to produce a main module that can be compiled into a static executable. 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))))))) A static executable implementing the website can then be compiled, e.g., with [[/egg/csm|csm]] via the command line {{csm -static -program main}}. === Runtime 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` == License Copyright (c) Pietro Cerutti All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. == Version History * 0.1.0 - initial release