https://github.com/thisandagain/fastly
Fastly API client for Node.js
https://github.com/thisandagain/fastly
cdn fastly javascript
Last synced: over 1 year ago
JSON representation
Fastly API client for Node.js
- Host: GitHub
- URL: https://github.com/thisandagain/fastly
- Owner: thisandagain
- License: mit
- Created: 2013-01-07T19:40:54.000Z (over 13 years ago)
- Default Branch: develop
- Last Pushed: 2023-04-19T06:04:59.000Z (about 3 years ago)
- Last Synced: 2024-05-02T01:17:36.824Z (about 2 years ago)
- Topics: cdn, fastly, javascript
- Language: JavaScript
- Size: 69.3 KB
- Stars: 70
- Watchers: 9
- Forks: 29
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [Fastly](http://www.fastly.com) API client for Node.js
---
**This project is not affiliated with Fastly.**
**Fastly now maintain [their own API client for JavaScript](https://github.com/fastly/fastly-js). Consider using that instead.**
---
[](https://travis-ci.org/thisandagain/fastly)
[](https://david-dm.org/thisandagain/fastly)
### Installation
```bash
npm install fastly
```
### Basic Use
```javascript
var fastly = require('fastly')('yourapikey');
fastly.request('GET', '/content/edge_check?url=mysite.com/foo', function (err, obj) {
if (err) return console.dir(err); // Oh no!
console.dir(obj); // Response body from the fastly API
});
```
### Helper Methods
The fastly module also includes a few limited "helper" methods that make working with common API resources a bit simpler:
Method
Example
purge
fastly.purge('host.com', '/index.html', callback);
Link
purgeAll
fastly.purgeAll('myServiceId', callback);
Link
purgeKey
fastly.purgeKey('myServiceId', 'key', callback);
Link
softPurgeKey
fastly.softPurgeKey('myServiceId', 'key', callback);
Link
stats
fastly.stats('myServiceId', callback);
Link
datacenters
fastly.datacenters(callback);
Link
publicIpList
fastly.publicIpList(callback);
Link
edgeCheck
fastly.edgeCheck('url', callback);
Link
### Testing
```bash
npm test
```