feat: Begins vapor application, begins view controller.

This commit is contained in:
2025-12-30 10:12:45 -05:00
parent 6eedb7396d
commit 4e1be161b1
15 changed files with 586 additions and 9 deletions

View File

@@ -6,7 +6,51 @@ extension SiteRoute {
/// Represents view routes.
///
/// The routes return html.
public enum View {
public enum View: Equatable, Sendable {
case project(ProjectRoute)
static let router = OneOf {
Route(.case(Self.project)) {
SiteRoute.View.ProjectRoute.router
}
}
}
}
extension SiteRoute.View {
public enum ProjectRoute: Equatable, Sendable {
case create(Project.Create)
case form
case index
static let rootPath = "projects"
public static let router = OneOf {
Route(.case(Self.create)) {
Path { rootPath }
Method.post
Body {
FormData {
Field("name", .string)
Field("streetAddress", .string)
Field("city", .string)
Field("state", .string)
Field("zipCode", .string)
}
.map(.memberwise(Project.Create.init))
}
}
Route(.case(Self.form)) {
Path {
rootPath
"create"
}
Method.get
}
Route(.case(Self.index)) {
Path { rootPath }
Method.get
}
}
}
}