网站宣传海报图片,海报模板免费下载网站,齐河县建设局网站,wordpress模板响应如图所示的俩个控制台功能#xff0c;调用腾讯云的接口执行这俩个动作 #xff08;代码可以优化#xff09;nodejs框架是express, 这里粘贴调用成功的代码示例#xff0c;做个记录。
app.get(/PurgeUrlsCache, async function (req, res, next) {// Depends on tencentclo…
如图所示的俩个控制台功能调用腾讯云的接口执行这俩个动作 代码可以优化nodejs框架是express, 这里粘贴调用成功的代码示例做个记录。
app.get(/PurgeUrlsCache, async function (req, res, next) {// Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher
const client new tencentcloud.cdn.v20180606.Client({credential: {secretId: XXX,secretKey: XXX,},region: ,profile: {signMethod: TC3-HMAC-SHA256,httpProfile: {reqMethod: POST,reqTimeout: 30,endpoint: cdn.tencentcloudapi.com,},},
})const params {Urls: [req.query.url]
};
// 清除CDN缓存
client.PurgeUrlsCache(params).then((data) {console.log(data);res.send(data);},(err) {console.error(error, err);}
);})app.get(/urlspushcache, async function (req, res, next) {// Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher
const client new tencentcloud.cdn.v20180606.Client({credential: {secretId: xxx,secretKey: xxx,},region: ,profile: {signMethod: TC3-HMAC-SHA256,httpProfile: {reqMethod: POST,reqTimeout: 30,endpoint: cdn.tencentcloudapi.com,},},
})const params {Urls: [req.query.url]
};
// 重新刷新预热
client.PushUrlsCache(params).then((data) {console.log(data);res.send(data);},(err) {console.error(error, err);}
);})