This PR contains the work done to replace the use of static _HTML_ files with type-safe HTML rendered server-side via **Elementary** through **Hummingbird**. To provide further details about the work done: * Added the **Elementary** dependencies. * Added the `IndexPage` and `ErrorPage` pages, ported from the old HTML boilerplate; removed the static files. * Added the `RootController` controller serving GET / using the `IndexPage` page, wired into the router. * Reworked the `NotFoundMiddleware` middleare to render `ErrorPage` page directly; non-notFound errors still propagate. * the `FileMiddleware` middleware no longer searches for any static `index.html` file. * Simplified the `StaticFile` enumeration, dropped unused constants and now-unnecessary throws. Reviewed-on: rock-n-code/loud-amsterdam#5 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
113 lines
3.0 KiB
Swift
113 lines
3.0 KiB
Swift
// swift-tools-version:6.3
|
|
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "Website",
|
|
platforms: [
|
|
.macOS(.v15),
|
|
.iOS(.v18),
|
|
.tvOS(.v18),
|
|
],
|
|
products: [
|
|
.executable(
|
|
name: "Website",
|
|
targets: [
|
|
"Website",
|
|
"WebsiteCore",
|
|
]
|
|
)
|
|
],
|
|
dependencies: [
|
|
.package(
|
|
url: "https://github.com/elementary-swift/elementary.git",
|
|
from: "0.6.0"
|
|
),
|
|
.package(
|
|
url: "https://github.com/hummingbird-community/hummingbird-elementary.git",
|
|
from: "0.3.0"
|
|
),
|
|
.package(
|
|
url: "https://github.com/hummingbird-project/hummingbird.git",
|
|
from: "2.25.0"
|
|
),
|
|
.package(
|
|
url: "https://github.com/apple/swift-configuration.git",
|
|
from: "1.0.0",
|
|
traits: [
|
|
.defaults,
|
|
"CommandLineArguments",
|
|
]
|
|
),
|
|
],
|
|
targets: [
|
|
.executableTarget(
|
|
name: "Website",
|
|
dependencies: [
|
|
.byName(name: "WebsiteCore"),
|
|
.product(
|
|
name: "Configuration",
|
|
package: "swift-configuration"
|
|
),
|
|
.product(
|
|
name: "Hummingbird",
|
|
package: "hummingbird"
|
|
),
|
|
],
|
|
path: "Sources/App"
|
|
),
|
|
.target(
|
|
name: "WebsiteCore",
|
|
dependencies: [
|
|
.product(
|
|
name: "Configuration",
|
|
package: "swift-configuration"
|
|
),
|
|
.product(
|
|
name: "Elementary",
|
|
package: "elementary"
|
|
),
|
|
.product(
|
|
name: "Hummingbird",
|
|
package: "hummingbird"
|
|
),
|
|
.product(
|
|
name: "HummingbirdElementary",
|
|
package: "hummingbird-elementary"
|
|
),
|
|
],
|
|
path: "Sources/Library"
|
|
),
|
|
.testTarget(
|
|
name: "WebsiteTests",
|
|
dependencies: [
|
|
.byName(name: "Website"),
|
|
.product(
|
|
name: "HummingbirdTesting",
|
|
package: "hummingbird"
|
|
),
|
|
],
|
|
path: "Tests/App"
|
|
),
|
|
.testTarget(
|
|
name: "WebsiteCoreTests",
|
|
dependencies: [
|
|
.byName(name: "WebsiteCore"),
|
|
.product(
|
|
name: "Elementary",
|
|
package: "elementary"
|
|
),
|
|
.product(
|
|
name: "Hummingbird",
|
|
package: "hummingbird"
|
|
),
|
|
.product(
|
|
name: "HummingbirdTesting",
|
|
package: "hummingbird"
|
|
),
|
|
],
|
|
path: "Tests/Library"
|
|
),
|
|
]
|
|
)
|