A simple AWS lambda function built with Serverless SDK that pulls a user's avatar from twitter or substack and returns it as a dataURL.
- Clone the repo
- Copy the
env.example.json
, add your Twitter Bearer Token, and rename toenv.offline.json
- Configure any port/server settings as desired
- Copy
env.example.json
toenv.dev.json
and add your Twitter Bearer Token
In serverless.yml
provider:environment:checkByDate
- Time in milliseconds until an avatar should be updated againprovider.environment:imageWidth
- Pixel width of avatar to be served
A successful response for either /twitter
or /substack
will return a URL to the file stored on S3 in a resopnse of the sort:
{
"url:"s3.amazonaws.com/avatar-star.twitter/..."
}
- For local testing
- Run
npm run local-server
- Access localhost:3000/twitter/{id} where {id} is any twitter ID or localhost:3000/substack/{id} where {id} is any substack ID
- Run
- To deploy to AWS
- Run
npm run deploy
- Run