feat: Begins vapor application, begins view controller.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user