This lambda is used to create posts on Medium through its API. A lambda is used because Medium doesn't allow cross site scripting, and Jekyll doesn't have a backend server from which it can make the call.
This will test your lambda locally, it will not deploy to AWS.
The command sls
may be used inplace of writting serverless
.
$> sls invoke local -f createPost
With debugging
$> SLS_DEBUG=* sls invoke local -f createPost
Complete example (replace env vars with correct values)
$> medium_client_id=1 medium_client_secret=2 medium_access_token=3 sls invoke local -f createPost --data '{"body": {"title": "hello", "body": "world"}}'
$> sls deploy
Enviroment variables are defined on the lambda entry on AWS. When running locally you must specify them on the command line.
The environment variables used by this lambda are from Medium, found under Jekyll React Integration Test
The following environment variables must be set when running this lambda locally too: