Note that in this example the path is /hello/:name, this will match /hello/world, /hello/you, and so forth. The named parameters in the path are added to the params dictionary in the request object. Query parameters are also included in this dictionary.

RouteResponses can respond with an NSString or NSData object, a path to a file, or an existing HTTPResponse class. Responses can also be empty as long as a status code or custom header is set. For example, to perform a redirect:

Default headers can be set through setDefaultHeader:value: or a dictionary passed to setDefaultHeaders. This allows you to add things like a Server header.

The Connection header is added to every response. You can set it explicitly in your response object if you want to force closing of a keep-alive connection.

The dispatch queue on which routes are processed can be changed. By default routes are processed on CocoaHTTPServer's connection queue, changing this to dispatch_get_main_queue() will process all routes on the main thread instead. Connection handling still occurs in the background, only the route handlers are impacted.