https://github.com/grohiro/echo-serverless-sample
Lambda Function の REST API を CDK でデプロイするサンプルプロジェクト.
https://github.com/grohiro/echo-serverless-sample
Last synced: over 1 year ago
JSON representation
Lambda Function の REST API を CDK でデプロイするサンプルプロジェクト.
- Host: GitHub
- URL: https://github.com/grohiro/echo-serverless-sample
- Owner: grohiro
- Created: 2022-12-25T06:59:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-25T06:59:47.000Z (over 3 years ago)
- Last Synced: 2025-02-24T01:48:25.462Z (over 1 year ago)
- Language: TypeScript
- Size: 83 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# echo-serverless
**サンプルプロジェクト**
Lambda Function と API Gateway で REST API を作成して CDK でデプロイする。
Lambda Function は TypeScript で実装して Jest でテストを実行する。
- API Gateway REST API
- Lambda Function
- TypeScript & Jest
- CDK
- Route53
- ACM
## CDK Context
CDK の Context を利用して環境別の設定を切り替える。
- `stageName`: 環境名。API Gateway のステージ名にも利用する。
- `customDomain`: REST API をデプロイするドメイン。
- `hostedZoneId`: Route53 で作成済みの PublicHostedZoneId。
## 仕様
- 本番環境: https://prod.example.com/
- 検証環境: https://dev.example.com/
### echo
送信した文字列をオウム返しする.
```
curl -X POST 'https://prod.example.com/v1/echo' -d 'Hello, World!'
#=> Hello, World!
curl -X POST 'https://prod.example.com/v1/echo?options=uppercase' -d 'Hello, World!'
#=> HELLO, WORLD!
```
### time
サーバーサイドの現在日時を ISO 8601 形式で返す.
```
curl 'https://prod.example.com/v1/time'
#=> 2022-12-15T14:28:00Z
```
### info
AWS Lambda の環境変数、イベント、コンテキスト情報を表示する.
```
curl 'https://prod.example.com/v1/info'
curl -X POST 'https://prod.example.com/v1/info'
```