This project implements the Mercury Parser API with AWS API Gateway and Lambda Function using Terraform.
Mercury takes any web article and returns only the relevant content — headline, author, body text, relevant images and more
- Git clone the mercury-parser-api
git clone [email protected]:RecastLLC/mercury-parser-api.git
cd mercury-parser-api
- Run
yarn install
inside themercury-parser-api
directory. - run
yarn build
- This command will build the lambda deployment zip file in the local path./serverless/mercury.zip
- Export the
AWS Access keys
to the environment terraform init
terraform plan
terraform apply [-auto-approve]
This will deploy the API Gateway REST API resources and the lambda function with the Mercury Parser API nodejs zip.
1 - Login to AWS Account and access the API Gateway resources
2 - Make a note of the API Gateway Stage Execution URL
3- Make a note of the API Gateway Access Key
Use the lambda_requestion.html
as the HTML
file as the payload and run the following command
curl -X POST -H "Content-Type:application/json" \
-H "cache-control":"no-cache" -H "x-api-key:API_KEY_HERE" \
-d @lambda_request.html https://API_GATEWAY_EXECUTION_URL/STAGE_NAME/parse-html
curl -X POST -H "Content-Type:application/json" \
-H "cache-control":"no-cache" -H \
"x-api-key:gHb7ARQQzv9Tl4JRrvpTU7018weheLITp8dBY6Od" \
-d @lambda_request.html https://hbhsnscb63.execute-api.ap-southeast-2.amazonaws.com/Prod/parse-html
The result output will be Plain Text Extracted from the payload html file.