Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
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 out of the box 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 /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.
FAQs
Choo Cloudflare Cache Purge – purge all routes served by choo app
The npm package cccpurge receives a total of 7 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.