diff --git a/collects/web-server/private/launch.ss b/collects/web-server/private/launch.ss index 077064dd91..3f911f7226 100644 --- a/collects/web-server/private/launch.ss +++ b/collects/web-server/private/launch.ss @@ -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) diff --git a/collects/web-server/scribblings/running.scrbl b/collects/web-server/scribblings/running.scrbl index 1e60d3acf5..04f60e8846 100644 --- a/collects/web-server/scribblings/running.scrbl +++ b/collects/web-server/scribblings/running.scrbl @@ -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,8 +139,14 @@ 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 you are likely to want to call this functions at the end of your script. -} +} \ No newline at end of file