I've been writing a library, DigitalOcean JS, for the last year in my spare time. I started it because I was building a DigitalOcean mobile app using Ionic for use in managing your DigitalOcean resources from your phone. In looking at the various libraries available for my use, I disliked them for a few reasons, including use of callback functions instead of Promises, only being able to use some in Node and not the browser, among other things. Due to those issues, I decided to build my own that was structured how I would like to use it, with some key goals in mind:
- Be able to use in a Node or Browser environment with no difference in usage.
- Use Promises instead of callbacks so clients can make use of
async
/await
. - Be built in TypeScript so consumers of the library can benefit from excellent intellisense with the TypeScript definitions.
- Provide solid documentation including examples for usage.
To that end I started development on DigitalOcean JS. Instead of building it all out quickly I decided to build it out as I needed it for the app I was building. As is usual with my side projects, (see my previous post) it languished to the side for a while. After writing that blog post, I decided that I wouldn't let this project die. I literally had one set of endpoints left to implement.
It is with great pleasure that I finally get to announce the official v1.0 release of DigitalOcean JS. Check it out at the repo below, and keep fighting to keep your side projects alive!
johnbwoodruff / digitalocean-js
JavaScript library for the DigitalOcean API
DigitalOcean JS
JavaScript library for the DigitalOcean API. For use in Node or the browser.
Goals
This library was built with a few goals in mind:
- Be able to use in a Node or Browser environment with no difference in usage.
- Use Promises instead of callbacks so clients can make use of
async
/await
. - Be built in TypeScript so consumers of the library can benefit from excellent intellisense with the TypeScript definitions.
- Provide solid documentation including examples for usage.
Usage
To use the library, install from the npm repository.
$ npm install --save digitalocean-js
# Alternatively install with yarn
$ yarn add digitalocean-js
Simply import the client and initialize it with your API token:
import { DigitalOcean } from 'digitalocean-js';
const client = new DigitalOcean('my-api-token');
To see all the services available, check out the documentation.
Top comments (10)
Great job!
Woohoo, congrats!
Thanks! :) Thrilled I finally "finished" it. (of course I've already thought of stuff I should implement now... it's never ending haha)
Nice!
This is really cool! Bookmarked for that perfect project or conversation :)
<3 from your friends at DigitalOcean
Thanks! :) Keep doing all the awesomeness you guys do best!!
digitalocean-ts
😫👌Yeah, I made a call on what would come up easier in a search for DigitalOcean JavaScript libraries. :) Thankfully all the TypeScript benefits still come with it despite the
js
in the name. ;)Is this official?
Not an official DigitalOcean library, just a community library I wrote to contribute to anyone who wants to use it. :)