Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.

Latest commit

 

History

History
51 lines (40 loc) · 1.48 KB

README.md

File metadata and controls

51 lines (40 loc) · 1.48 KB

Apex TypeScript Example

Setup

To run the example first setup your AWS credentials. You also need to install apex and Terraform cli.

Installation

$ git clone https://github.com./stanislaw-glogowski/apex-typescript-example.git && cd ./apex-typescript-example
$ npm install
$ apex infra apply # creating lambda role
$ apex deploy
$ apex infra apply # creating api gateway

Invoke functions

You can test your lambda function using apex cli

$ apex invoke lambda_with_api_gateway_event < ./events/api-gateway.json

output:

{
  "statusCode": 200,
  "headers": {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Credentials": true,
    "Content-Type": "application/json"
  },
  "body": "{\"method\":\"GET\"}"
}

In addition, lambda_with_api_gateway_event is integrated with API Gateway in infrastructure configuration. After successful installation there should be apex-typescript-example_api_gateway api, available from AWS console.

Destroying

$ apex infra destroy # destroying infrastructure
$ apex infra apply   # creating lambda role (needed for deleting lambdas)
$ apex delete        # deleting lambdas
$ apex infra destroy # final infrastructure destroying

License

The MIT License