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

Update the HB 2 template #1

Merged
merged 1 commit into from Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.swift
Expand Up @@ -10,7 +10,7 @@ let package = Package(
.executable(name: "App", targets: ["App"]),
],
dependencies: [
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-alpha.1"),
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-beta.1"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0")
],
targets: [
Expand All @@ -29,7 +29,7 @@ let package = Package(
.testTarget(name: "AppTests",
dependencies: [
.byName(name: "App"),
.product(name: "HummingbirdXCT", package: "hummingbird")
.product(name: "HummingbirdTesting", package: "hummingbird")
]
)
]
Expand Down
6 changes: 3 additions & 3 deletions Sources/App/Application+build.swift
Expand Up @@ -9,12 +9,12 @@ public protocol AppArguments {
var port: Int { get }
}

public func buildApplication(_ arguments: some AppArguments) -> some HBApplicationProtocol {
let router = HBRouter()
public func buildApplication(_ arguments: some AppArguments) -> some ApplicationProtocol {
let router = Router()
router.get("/health") { _,_ -> HTTPResponse.Status in
return .ok
}
let app = HBApplication(
let app = Application(
router: router,
configuration: .init(
address: .hostname(arguments.hostname, port: arguments.port),
Expand Down
4 changes: 2 additions & 2 deletions Tests/AppTests/AppTests.swift
@@ -1,6 +1,6 @@
@testable import App
import Hummingbird
import HummingbirdXCT
import HummingbirdTesting
import XCTest

final class AppTests: XCTestCase {
Expand All @@ -13,7 +13,7 @@ final class AppTests: XCTestCase {
let args = TestArguments()
let app = buildApplication(args)
try await app.test(.router) { client in
try await client.XCTExecute(uri: "/health", method: .get) { response in
try await client.execute(uri: "/health", method: .get) { response in
XCTAssertEqual(response.status, .ok)
}
}
Expand Down