Skip to content

Commit 68c9199

Browse files
committed
Use new NeXTless Macro API
Simpler code is always good ;-)
1 parent 29e4b07 commit 68c9199

File tree

7 files changed

+10
-8
lines changed

7 files changed

+10
-8
lines changed

AppLogic/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let package = Package(
2020
from: "1.0.8"),
2121

2222
.package(url: "https://github.com/Macro-swift/MacroExpress.git",
23-
from: "1.0.0"),
23+
from: "1.0.2"),
2424

2525
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
2626
],

LighterExamples.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
E87B412C28A3DCAD00576D8A /* BodiesApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BodiesApp.swift; sourceTree = "<group>"; };
9595
E87B412D28A3DCAD00576D8A /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
9696
E87D45FE28A3C341008E04EA /* NavViewMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavViewMain.swift; sourceTree = "<group>"; };
97+
E8924C3129DA2873008BD781 /* Lighter */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Lighter; path = ../Lighter; sourceTree = "<group>"; };
9798
E8AF70C928A3DDE9008444B2 /* BodiesDB-001.sql */ = {isa = PBXFileReference; lastKnownFileType = text; path = "BodiesDB-001.sql"; sourceTree = "<group>"; };
9899
/* End PBXFileReference section */
99100

@@ -128,6 +129,7 @@
128129
E8224F8228A005CF00246A1F = {
129130
isa = PBXGroup;
130131
children = (
132+
E8924C3129DA2873008BD781 /* Lighter */,
131133
E8224FDB28A0557000246A1F /* README.md */,
132134
E8224FDD28A0557000246A1F /* LICENSE */,
133135
E8224FDC28A0557000246A1F /* CONTRIBUTING.md */,

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var package = Package(
1616
from: "1.0.8"),
1717

1818
.package(url: "https://github.com/Macro-swift/MacroExpress.git",
19-
from: "1.0.0"),
19+
from: "1.0.2"),
2020

2121
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
2222
],

Sources/NorthwindWebAPI/Products.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func products(req: IncomingMessage, res: ServerResponse, next: Next) throws {
2525
"limit" : limit,
2626
"lowerLimit" : (limit - 10) > 1 ? (limit - 10) : 1,
2727
"higherLimit" : limit + limit
28-
])
28+
] as [String : Any])
2929
}
3030

3131
/// This is the endpoint which drives the page for a single product.

Sources/NorthwindWebAPI/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let app = express()
5858

5959
// Map `/api/products` to a handler which fetches all "products" from the DB.
6060
// Access using: curl http://localhost:1337/api/products | jq .
61-
app.get("/api/products") { _, res, _ in
61+
app.get("/api/products") { _, res in
6262
res.send(try db.products.fetch())
6363
}
6464

@@ -68,7 +68,7 @@ app.get(db, prefix: "/api/")
6868
app // Those hook up the HTML pages/templates.
6969
.get("/products.html", products)
7070
.get("/products/:id/", product)
71-
.get("/") { _, res, _ in res.render("index") }
71+
.get("/") { _, res in res.render("index") }
7272

7373
app.listen(1337) // start server
7474
```

Sources/NorthwindWebAPI/main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ app.set("views", __dirname() + "/views")
1818

1919
// This is an explicit registration for a specific record fetch.
2020
// curl http://localhost:1337/api/products | jq .
21-
app.get("/api/products") { _, res, _ in
21+
app.get("/api/products") { _, res in
2222
res.send(try db.products.fetch())
2323
}
2424

@@ -32,7 +32,7 @@ app
3232
.get("/products.html", products)
3333
.get("/products/:id/", product)
3434

35-
app.get("/") { _, res, _ in
35+
app.get("/") { _, res in
3636
res.render("index")
3737
}
3838

Sources/NorthwindWebAPI/views/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ <h2 class="ui header">Server Setup</h2>
5757
let app = express()
5858

5959
app
60-
.get("/products") { _, res, _ in
60+
.get("/products") { _, res in
6161
res.send(try db.products.fetch())
6262
}
6363
.listen(1337)

0 commit comments

Comments
 (0)