Service to clear cache for Accelerated Mobile Pages on all Content Delivery Network (CDN) servers.
This guide helps you who already have Accelerated Mobile Pages (AMP), to update your content more quickly.
To use google /update-cache
, you need generate 1 RSA key pair. To generate, and configure, follow this guide of google
After generate you pair, you need move file private-key.pem
to src/assets
folder.
npm install
# or
yarn install
Open in your editor the file env.dev.yml
and update only SITE_DOMAIN
for your website address.
$ npm start
# or
$ yarn start
if you have success to run, you will receive a message similar to this:
serverless offline --stage=dev
offline: Starting Offline: dev/sa-east-1.
┌─────────────────────────────────────────────────────────────────────────┐
│ │
│ POST | http://localhost:3000/dev/amp/clear-cache │
│ POST | http://localhost:3000/2015-03-31/functions/clearCache/invocations │
│ │
└─────────────────────────────────────────────────────────────────────────┘
offline: [HTTP] server ready: http://localhost:3000 🚀
offline:
offline: Enter "rp" to replay the last request
After run service, locate your endpoint, by default is: http://localhost:3000/dev/amp/clear-cache
and send POST
request to your endpoint with body
{
"urls": ["/path/to/your/page/amp"]
}
where urls
is one array of amp path pages
- add to run using Docker
Name | Link |
---|---|
node | here |
axios | here |
middy | here |
serverless | here |
serverless-offline | here |