On this page:
server?
make-server-factory

25 Server🔗

 (require koyo/server) package: koyo-lib

This module provides a web server component.

procedure

(server? v)  boolean?

  v : any/c
Returns #t when v is a server.

procedure

((make-server-factory [#:unix-socket socket-path    
  #:limits limits    
  #:host host    
  #:port port    
  #:tcp@ tcp@])    
  dispatcher)  server?
  socket-path : (or/c #f path-string?) = #f
  limits : safety-limits? = (make-safety-limits)
  host : non-empty-string? = "127.0.0.1"
  port : (integer-in 0 65535) = 8000
  tcp@ : (unit/c (import) (export tcp^)) = racket/tcp
  dispatcher : dispatcher/c
Creates a component that, when started, runs a web server bound to #:host and #:port using the given dispatcher. When the #:unix-socket argument is provided, the server is bound to a socket at that path instead and the #:host and #:port arguments are ignored. When the server component is stopped, the unix socket (if provided) is deleted.

The #:limits are passed directly to serve.

The #:tcp@ argument can be used to change the underlying tcp^ implementation. When the #:unix-socket argument is provided, it takes precedence over the #:tcp@ argument.

Changed in version 0.26 of package koyo-lib: Added the #:tcp@ argument.