This is a repository for go-lambda-twitter - Twitter client built by API Gateway + Lambda in AWS.
.
├── Makefile <-- Make to automate build
├── README.md <-- This instructions file
├── lambda <-- Source code for a lambda function
│ ├── main.go <-- Lambda function code
│ └── main_test.go <-- Unit tests
└── template.yaml
- AWS CLI already configured with Administrator permission
- Docker installed
- Golang
- SAM CLI - Install the SAM CLI
make
Invoking function locally through local API Gateway
cp env.example.json env.json
make api
Calling health check endpoint with cURL
# GET
curl --request GET \
--url http://127.0.0.1:3000/health | jq .
{
"message": "OK"
}
# POST
curl --request POST \
--url http://127.0.0.1:3000/tweet \
-d '{ "text": "test" }' | jq .
{
"message": "Tweeted successfully",
"tweet_text": "test",
"tweet_url":"https://twitter.com/ega4432/status/1555603271665913856"
}
From local
cp .env.example .env
make deploy