directus-sdk-javascript
Directus SDK for JavaScript (Node and Browser)
Installation
Install the package via npm
npm install directus-sdk-javascript
Usage
Require the RemoteInstance class (support for local instances coming soon)
const RemoteInstance = require('directus-sdk-javascript/remote');
const client = new RemoteInstance({
url: 'http://instance.directus.io/api/1.1/',
accessToken: [user-token]
});
The client returns a Promise which resolves the APIs JSON data on succes and rejects on error
client.getItems('projects')
.then(res => console.log(res))
.catch(err => console.log(err));
Check the official API docs for a complete overview of all endpoints and available methods