BreezeLambdaDynamoDBAPI

main

Implement a CRUD API based on AWS Lambda, APIGateway, DynamoDB
swift-serverless/BreezeLambdaDynamoDBAPI

BreezeLambdaDynamoDBAPI

Breeze CI codecov

security status stability status licensing status

Breeze

Usage

Add the dependency BreezeLambdaDynamoDBAPI to a package:

// swift-tools-version:5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "BreezeItemAPI",
    platforms: [
        .macOS(.v13),
    ],
    products: [
        .executable(name: "ItemAPI", targets: ["ItemAPI"]),
    ],
    dependencies: [
        .package(url: "https://github.com/swift-sprinter/BreezeLambdaDynamoDBAPI.git", from: "0.4.0")
    ],
    targets: [
        .executableTarget(
            name: "ItemAPI",
             dependencies: [
                .product(name: "BreezeLambdaAPI", package: "Breeze"),
                .product(name: "BreezeDynamoDBService", package: "Breeze"),
            ]
        )
    ]
)

Add a Codable struct entity conformed to the BreezeCodable protocol:

import Foundation
import BreezeLambdaAPI
import BreezeDynamoDBService

struct Item: Codable {
    public var key: String
    public let name: String
    public let description: String
    public var createdAt: String?
    public var updatedAt: String?
    
    enum CodingKeys: String, CodingKey {
        case key = "itemKey"
        case name
        case description
        case createdAt
        case updatedAt
    }
}

extension Item: BreezeCodable { }

Add the implementation of the Lambda to the file swift.main

BreezeLambdaAPI<Item>.main()

Documentation

Refer to the main project https://github.com/swift-serverless/Breeze for more info and working examples.

Contributing

Contributions are welcome! If you encounter any issues or have ideas for improvements, please open an issue or submit a pull request.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

Last updated: Sat Oct 19 2024 20:14:26 GMT-0900 (Hawaii-Aleutian Daylight Time)