Skip to content

hummingbird-project/hummingbird

Folders and files

NameName
Last commit message
Last commit date
Sep 18, 2024
Sep 14, 2024
Sep 25, 2024
Sep 20, 2024
Oct 17, 2023
Sep 18, 2024
Apr 29, 2021
Feb 19, 2024
Sep 9, 2024
Dec 7, 2022
Jul 9, 2024
Jan 28, 2021
Jul 9, 2024
Sep 9, 2024
Sep 18, 2024
Jan 11, 2021
Sep 13, 2024
Sep 13, 2024
Sep 20, 2024
Jul 29, 2023

Repository files navigation

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()

Extending Hummingbird

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

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.