Lightweight, flexible, modern server framework written in Swift.
Hummingbird is a lightweight, flexible modern web application framework that runs on top of a SwiftNIO based server implementation. It is designed to require the minimum number of dependencies.
It provides a router for directing different endpoints to their handlers, middleware for processing requests before they reach your handlers and processing the responses returned, custom encoding/decoding of requests/responses, TLS and HTTP2.
import Hummingbird
// create router and add a single GET /hello route
let router = Router()
router.get("hello") { request, _ -> String in
return "Hello"
}
// create application using router
let app = Application(
router: router,
configuration: .init(address: .hostname("127.0.0.1", port: 8080))
)
// run hummingbird application
try await app.runService()
Hummingbird is designed to require the least number of dependencies possible, but this means many features are unavailable to the core libraries. Additional features are provided through extensions. The Hummingbird repository comes with additional modules
HummingbirdRouter
: an alternative router that uses a resultbuilder.HummingbirdTLS
: TLS support.HummingbirdHTTP2
: Support for HTTP2 upgrades.HummingbirdTesting
: helper functions to aid testing Hummingbird projects.
And also the following are available in other repositories in this organisation
HummingbirdAuth
: Authentication frameworkHummingbirdFluent
: Integration with Vapor's database ORM FluentKit.HummingbirdRedis
: Redis support via RediStack.HummingbirdWebSocket
: Support for WebSockets (Currently work in progess).HummingbirdLambda
: Framework for running Hummingbird on AWS Lambdas.Jobs
: Job Queue FrameworkMustache
: Mustache templating engine.
You can find reference documentation and user guides for Hummingbird here. The hummingbird-examples repository has a number of examples of different uses of the library.