-
Notifications
You must be signed in to change notification settings - Fork 0
Home
luisan00 edited this page Jun 9, 2019
·
5 revisions
npm install fastly-lib --save
- Node.js
Tested on versions 8, 10 and 12
fastly-lib exposes a list of methods listed in the Fastly's documentation, for example if we want to access to the content method
const Fastly = require("fastly-lib");
const fslib = new Fastly("your_api_key");
fslib.content("http://example.com/path/to.jpg")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
for those methods not listed in this documentation we can to use
// see https://docs.fastly.com/api/config#domain
// Checks the status of all domains' DNS records for a Service Version
const Fastly = require("fastly-lib");
const fslib = new Fastly("your_api_key");
const service_id = "SU1Z0isxPaozGVKXdv0eY";
const version = 1;
fslib.request.get(`/service/${service_id}/version/${version}/domain/check_all`)
.then((res) => {
console.log(res);
})
.then((err) => {
console.log(err);
})