Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge HBApplication and HBApplicationBuilder #254

Merged
merged 4 commits into from
Oct 31, 2023
Merged

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Oct 27, 2023

It does mean the router has to be built before the application, as HBRouterBuilder would be a painful to setup as Sendable.
But the advantage of breaking out the router builder is it opens up other possibilities for other forms of route building.

let router = HBRouterBuilder()
router.middlewares.add(HBFileMiddleware())
router.get("test/") { _, context in
    return context.endpointPath
}
router.post("test2") { _, context in
    return context.endpointPath
}
let app = HBApplication(responder: router.buildResponder())
try await app.runService()

It does also mean the application isn't available when building routes, so data attached to application is not available (eg EventLoopGroup). But then we are trying to move away from HBApplication being a central source of data.

Base automatically changed from sendable-responder to 2.x.x October 29, 2023 07:29
@codecov
Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Files Coverage Δ
...Hummingbird/Server/Application+HTTPResponder.swift 100.00% <100.00%> (ø)
...rces/Hummingbird/Storage/MemoryPersistDriver.swift 70.90% <100.00%> (+0.53%) ⬆️
...s/HummingbirdFoundation/Files/FileMiddleware.swift 95.90% <ø> (ø)
Sources/HummingbirdXCT/Application+XCT.swift 100.00% <100.00%> (ø)
Sources/HummingbirdXCT/HBXCTLive.swift 93.15% <100.00%> (+0.09%) ⬆️
Sources/HummingbirdXCT/HBXCTRouter.swift 92.59% <100.00%> (-0.35%) ⬇️
Sources/Hummingbird/Application.swift 80.89% <76.81%> (-19.11%) ⬇️

... and 6 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

@adam-fowler adam-fowler merged commit 74bf146 into 2.x.x Oct 31, 2023
6 of 7 checks passed
@adam-fowler adam-fowler deleted the merge-application branch October 31, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants