Better docs for serve variants
svn: r12171
This commit is contained in:
parent
2dbeb18164
commit
10127c9561
|
@ -1,14 +1,9 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
(require scheme/tcp
|
(require mzlib/cmdline
|
||||||
mzlib/cmdline
|
mzlib/pregexp)
|
||||||
mzlib/pregexp
|
|
||||||
mzlib/unit
|
|
||||||
net/tcp-sig)
|
|
||||||
(require "../configuration/configuration-table.ss"
|
(require "../configuration/configuration-table.ss"
|
||||||
"../web-config-unit.ss"
|
(except-in "../web-server.ss" serve)
|
||||||
"../web-config-sig.ss"
|
"../web-config-unit.ss")
|
||||||
"../web-server-unit.ss"
|
|
||||||
"../web-server-sig.ss")
|
|
||||||
|
|
||||||
; this is used by launchers
|
; this is used by launchers
|
||||||
; extract-flag : sym (listof (cons sym alpha)) alpha -> alpha
|
; extract-flag : sym (listof (cons sym alpha)) alpha -> alpha
|
||||||
|
@ -55,16 +50,7 @@
|
||||||
#:listen-ip (extract-flag 'ip-address flags #f)))
|
#:listen-ip (extract-flag 'ip-address flags #f)))
|
||||||
'()))
|
'()))
|
||||||
|
|
||||||
(define-compound-unit launch@
|
(define (serve)
|
||||||
(import (T : tcp^))
|
(serve/web-config@ configuration@))
|
||||||
(export S)
|
|
||||||
(link
|
|
||||||
[((C : web-config^)) configuration@]
|
|
||||||
[((S : web-server^)) web-server@ T C]))
|
|
||||||
|
|
||||||
(define-values/invoke-unit
|
|
||||||
launch@
|
|
||||||
(import tcp^)
|
|
||||||
(export web-server^))
|
|
||||||
|
|
||||||
(provide serve)
|
(provide serve)
|
||||||
|
|
|
@ -102,6 +102,8 @@ Here's an example of a simple web server that serves files
|
||||||
from a given path:
|
from a given path:
|
||||||
|
|
||||||
@(require (for-label web-server/dispatchers/filesystem-map)
|
@(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)))
|
(prefix-in files: (for-label web-server/dispatchers/dispatch-files)))
|
||||||
|
|
||||||
@schemeblock[
|
@schemeblock[
|
||||||
|
@ -137,6 +139,12 @@ from a given path:
|
||||||
a function that shuts down all of the server instances.
|
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]{
|
@defproc[(do-not-return) void]{
|
||||||
This function does not return. If you are writing a script to load the @web-server
|
This function does not return. If you are writing a script to load the @web-server
|
||||||
|
|
Loading…
Reference in New Issue
Block a user