Swiftpack.co - hummingbird-project/hummingbird as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hummingbird-project.
hummingbird-project/hummingbird 2.0.0-beta.2
Lightweight, flexible HTTP server framework written in Swift
⭐️ 744
🕓 3 weeks ago
iOS macOS tvOS linux macOS iOS
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-beta.2")

Lightweight, flexible, modern server framework written in Swift.

Hummingbird

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 v2 is currently in development an beta release is available if you'd like to try it out.

Hummingbird Extensions

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

  • HummingbirdJobs: framework for pushing work onto a queue to be processed outside of a request (possibly by another server instance).
  • 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

Documentation

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.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics