ServerDelegate
public protocol ServerDelegate : AnyObject
The protocol defining the delegate for the HTTPServer and the FastCGIServer classes. The delegate’s handle function is invoked when new requests arrive at the server for processing.
-
Handle new incoming requests to the server
Declaration
Swift
func handle(request: ServerRequest, response: ServerResponse)
Parameters
request
The ServerRequest class instance for working with this request. The ServerRequest object enables you to get the query parameters, headers, and body amongst other information about the incoming request.
response
The ServerResponse class instance for working with this request. The ServerResponse object enables you to build and send your response to the client who sent the request. This includes headers, the body, and the response code.