Skip to content

Latest commit

 

History

History
100 lines (72 loc) · 2.51 KB

README.md

File metadata and controls

100 lines (72 loc) · 2.51 KB

Breeze Form API

Serverless REST API wiht Breeze

The example shows how to build a Rest API based on an Form swift struct.

struct Form: 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 = "formKey"
        case name
        case description
        case createdAt
        case updatedAt
    }
}

extension Form: BreezeCodable { }

The API implements the following schema:

- /forms
    -> GET - List Form
    -> POST - Create Form
    -> PUT - Update Form
- /forms/{formKey}
    -> DELETE - Delete Form
    -> GET - Get Form

The full definition is included in swagger.json.

Requirements

Framework Core: 3.25.0 (standalone)
Plugin: 6.2.2
SDK: 4.3.2
  • Ensure your AWS Account has the right credentials to deploy a Serverless stack.
  • Clone this repository. From the command line type:
  • Ensure you can run make

Deployment Example

The serverles.yml deploys the reference architecture for a Serverless Rest API implemented with Breeze in Swift.

Build

Use the following command to build the code before using the serverless commands:

./build.sh

Deploy

Deploy the full solution to your AWS using Serverless:

./deploy.sh

After the deployment is completed, the URL of the website is provided by the Serverless framework.

Update

Rebuild the code and update the Lambda to your AWS using Serverless:

./update.sh

Remove

To remove the deployment:

./remove.sh

arm64 M1 Graviton Support

If the project is built with an M1 processor, then the AWS Lambda will be deployed on the arm64 architecture.

amd64/x86_64 Support

If the project is built with an Intel processor, then the AWS Lambda will be deployed on the x86_64 architecture.

Security Warning

The Example deploys an open endpoint that is not protected, granting open access to anyone from the internet. You need to secure the API gateway endpoints. You can find more on AWS Documentation about Controlling and managing access to an HTTP API in API Gateway