Better docs for serve variants

svn: r12171
This commit is contained in:
Jay McCarthy 2008-10-29 22:21:37 +00:00
parent 2dbeb18164
commit 10127c9561
2 changed files with 15 additions and 21 deletions

View File

@ -1,14 +1,9 @@
#lang scheme/base
(require scheme/tcp
mzlib/cmdline
mzlib/pregexp
mzlib/unit
net/tcp-sig)
(require mzlib/cmdline
mzlib/pregexp)
(require "../configuration/configuration-table.ss"
"../web-config-unit.ss"
"../web-config-sig.ss"
"../web-server-unit.ss"
"../web-server-sig.ss")
(except-in "../web-server.ss" serve)
"../web-config-unit.ss")
; this is used by launchers
; extract-flag : sym (listof (cons sym alpha)) alpha -> alpha
@ -55,16 +50,7 @@
#:listen-ip (extract-flag 'ip-address flags #f)))
'()))
(define-compound-unit launch@
(import (T : tcp^))
(export S)
(link
[((C : web-config^)) configuration@]
[((S : web-server^)) web-server@ T C]))
(define-values/invoke-unit
launch@
(import tcp^)
(export web-server^))
(define (serve)
(serve/web-config@ configuration@))
(provide serve)

View File

@ -102,6 +102,8 @@ Here's an example of a simple web server that serves files
from a given path:
@(require (for-label web-server/dispatchers/filesystem-map)
(for-label web-server/web-config-unit)
(for-label web-server/web-config-sig)
(prefix-in files: (for-label web-server/dispatchers/dispatch-files)))
@schemeblock[
@ -137,6 +139,12 @@ from a given path:
a function that shuts down all of the server instances.
}
@defproc[(serve/web-config@ [config@ web-config^])
(-> void)]{
Starts the @web-server with the settings defined by the given @scheme[web-config^] unit.
It is very useful to combine this with @scheme[configuration-table->web-config@] and @scheme[configuration-table-sexpr->web-config@].
}
@defproc[(do-not-return) void]{
This function does not return. If you are writing a script to load the @web-server