Classes
The following classes are available globally.
-
Application class. Brings together all the components of Hummingbird together
Create an HBApplication, setup your application middleware, encoders, routes etc and then call
start
to start the server andwait
to wait until the server is stopped.let app = HBApplication() app.middleware.add(MyMiddleware()) app.get("hello") { _ in return "hello" } app.start() app.wait()
Editing the application setup after calling
See morestart
will produce undefined behaviour.Declaration
Swift
public final class HBApplication : HBExtensible
-
Group of middleware that can be used to create a responder chain. Each middleware calls the next one
See moreDeclaration
Swift
public final class HBMiddlewareGroup
-
Current date cache.
Getting the current date formatted is an expensive operation. This creates a scheduled task that will update a cached version of the date in the format as detailed in RFC1123 once every second. To avoid threading issues it is assumed that
See morecurrentDate
will only every be accessed on the same EventLoop that the update is running.Declaration
Swift
public final class HBDateCache