Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Purge Cloudflare cache of all routes served by a Choo app. This is usefull when enabling cache for all content and you later need to purge the cache for html pages due to updated content or when publishing a new version of your app. E.g. one could use this as part of a webhook that is triggerd by changes made to a CMS or as part of a deploy script.
You'll need to get your Cloudflare Zone ID
, it's on the dashboard overview when signing into your Cloudflare account. Just below that is a link to get your API key
.
#!/usr/bin/env node
var cccpurge = require('cccpurge')
cccpurge(require('./index'), {
root: 'https://www.my-blog.com',
email: 'foo@my-blog.com',
zone: '7sef78we7hwhefw3hri3uhriu32rwehf',
key: '0046ffew5f560675hny5765r7gre6005reg05'
}, console.log)
Dynamics routes (wildcards/params) are supported but you'll have to supply a function that resolves them to actual urls. The resolve function is given the route (e.g. /posts/:post
) and a callback. How you resolve /posts/:post
to e.g. /post/my-first-post
is completely up to you. Here's an example using Prismic.
#!/usr/bin/env node
var Prismic = require('prismic-javascript')
var cccpurge = require('cccpurge')
var app = require('./index')
var opts = {
resolve: resolve,
root: 'https://www.my-blog.com',
email: 'foo@my-blog.com',
zone: '7sef78we7hwhefw3hri3uhriu32rwehf',
key: '0046ffew5f560675hny5765r7gre6005reg05'
}
cccpurge(app, opts, done)
function done (err, response) {
if (err) console.error(err)
else console.log('Cache purged!')
process.exit(0)
}
function resolve (route, done) {
// only bother purging posts
if (route !== '/posts/:post') return done(null)
// fetch posts from prismic api
Prismic.getApi('https://my-site.cdn.prismic.io/api/v2')).then(function (api) {
return api.query(
Prismic.Predicates.at('document.type', 'blog-post')
).then(function (response) {
done(null, response.results.map((post) => `/posts/${post.uid}`))
})
}).catch(done)
}
Cloudinary has a limit of maximum 30 urls per call to the purge endpoint. We respect that limit but it can be overridden by setting opts.limit
to any number. Requests are made in parallel with a miximum of limit
urls per request.
30
. Number of urls submited per request.[]
. List of urls (other than routes) you want purged.MIT
FAQs
Choo Cloudflare Cache Purge – purge all routes served by choo app
The npm package cccpurge receives a total of 5 weekly downloads. As such, cccpurge popularity was classified as not popular.
We found that cccpurge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.