Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hummingbird-project/hummingbird
Lightweight, flexible HTTP server framework written in Swift
https://github.com/hummingbird-project/hummingbird
http http-server server server-side-swift swift swift-nio web web-server
Last synced: 4 days ago
JSON representation
Lightweight, flexible HTTP server framework written in Swift
- Host: GitHub
- URL: https://github.com/hummingbird-project/hummingbird
- Owner: hummingbird-project
- License: apache-2.0
- Created: 2021-01-08T06:58:48.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-25T14:52:56.000Z (3 months ago)
- Last Synced: 2024-10-25T16:19:28.112Z (3 months ago)
- Topics: http, http-server, server, server-side-swift, swift, swift-nio, web, web-server
- Language: Swift
- Homepage: https://hummingbird.codes/
- Size: 11.5 MB
- Stars: 1,175
- Watchers: 22
- Forks: 52
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
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.
```swift
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's core is designed to be minimal, with additional features provided through extensions. Here are some official extensions:
### Built-in Extensions
- `HummingbirdRouter`: An alternative router using result builders
- `HummingbirdTLS`: TLS support
- `HummingbirdHTTP2`: HTTP2 upgrade support
- `HummingbirdTesting`: Helper functions for testing Hummingbird projects### Additional Extensions
The following extensions are available in separate repositories:
- [HummingbirdAuth](https://github.com/hummingbird-project/hummingbird-auth): Authentication framework
- [HummingbirdFluent](https://github.com/hummingbird-project/hummingbird-fluent): Integration with Vapor's FluentKit ORM
- [HummingbirdRedis](https://github.com/hummingbird-project/hummingbird-redis): Redis support via RediStack
- [HummingbirdWebSocket](https://github.com/hummingbird-project/hummingbird-websocket): WebSocket support
- [HummingbirdLambda](https://github.com/hummingbird-project/hummingbird-lambda): Run Hummingbird on AWS Lambda
- [Jobs](https://github.com/hummingbird-project/swift-jobs): Job Queue Framework
- [Mustache](https://github.com/hummingbird-project/swift-mustache): Mustache templating engine## Documentation
You can find reference documentation and user guides for Hummingbird [here](https://docs.hummingbird.codes/2.0/documentation/hummingbird/). The [hummingbird-examples](https://github.com/hummingbird-project/hummingbird-examples/tree/main) repository has a number of examples of different uses of the library.
## Installation
Add the following to your `Package.swift` file:
```swift
dependencies: [
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0")
],
targets: [
.executableTarget(
name: "MyApp",
dependencies: [
.target(name: "Hummingbird"),
]),
]
```Or run the following commands on your package using SwiftPM, replacing `MyApp` with the name of your target:
```swift
swift package add-dependency https://github.com/hummingbird-project/hummingbird.git --from 2.0.0
swift package add-target-dependency Hummingbird MyApp
```## Contributing
We welcome contributions to Hummingbird! Please read our [contributing guidelines](CONTRIBUTING.md) before submitting a pull request.
## License
Hummingbird is released under the [Apache 2.0 license](LICENSE).