Skip to content

Commit 3c47622

Browse files
author
Andrea Scuderi
committed
Update the documentation
1 parent 8f8a0e2 commit 3c47622

File tree

3 files changed

+98
-16
lines changed

3 files changed

+98
-16
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# BreezeLambdaAPI
2+
3+
@Metadata {
4+
@PageImage(purpose: icon, source: "Icon")
5+
}
6+
7+
## Essentials
8+
9+
Add the dependency `BreezeLambdaDynamoDBAPI` to a package:
10+
11+
```swift
12+
// swift-tools-version:6.1
13+
// The swift-tools-version declares the minimum version of Swift required to build this package.
14+
15+
import PackageDescription
16+
17+
let package = Package(
18+
name: "BreezeItemAPI",
19+
platforms: [
20+
.macOS(.v13),
21+
],
22+
products: [
23+
.executable(name: "ItemAPI", targets: ["ItemAPI"]),
24+
],
25+
dependencies: [
26+
.package(url: "https://github.com/swift-sprinter/BreezeLambdaDynamoDBAPI.git", from: "0.4.0")
27+
],
28+
targets: [
29+
.executableTarget(
30+
name: "ItemAPI",
31+
dependencies: [
32+
.product(name: "BreezeLambdaAPI", package: "Breeze"),
33+
.product(name: "BreezeDynamoDBService", package: "Breeze"),
34+
]
35+
)
36+
]
37+
)
38+
```
39+
40+
Add a `Codable` `struct` entity conformed to the `BreezeCodable` protocol:
41+
42+
```swift
43+
import Foundation
44+
import BreezeLambdaAPI
45+
import BreezeDynamoDBService
46+
47+
struct Item: Codable {
48+
public var key: String
49+
public let name: String
50+
public let description: String
51+
public var createdAt: String?
52+
public var updatedAt: String?
53+
54+
enum CodingKeys: String, CodingKey {
55+
case key = "itemKey"
56+
case name
57+
case description
58+
case createdAt
59+
case updatedAt
60+
}
61+
}
62+
63+
extension Item: BreezeCodable { }
64+
```
65+
66+
Add the implementation of the Lambda to the file `swift.main`
67+
68+
```swift
69+
@main
70+
struct BreezeLambdaItemAPI {
71+
static func main() async throws {
72+
do {
73+
try await BreezeLambdaAPI<Item>().run()
74+
} catch {
75+
print(error.localizedDescription)
76+
}
77+
}
78+
}
79+
```
80+
81+
## Deployment
82+
83+
Refer to the main project https://github.com/swift-serverless/Breeze for more info on how to deploy it on AWS.
84+
85+
86+
87+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"theme": {
3+
"color": {
4+
"header": "#DE5E44",
5+
"documentation-intro-title": "#FFFFFF",
6+
"documentation-intro-figure": "#FFFFFF",
7+
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-header) 30%, #000 100%)",
8+
"documentation-intro-accent": "var(--color-header)"
9+
}
10+
}
11+
}

Sources/BreezeLambdaDynamoDBAPI.docc/BreezeLambdaDynamoDBAPI.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)