Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.07 KB

README.md

File metadata and controls

35 lines (25 loc) · 1.07 KB

directus-sdk-javascript

Directus SDK for JavaScript (Node and Browser)

Directus Logo

NPM

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] // optional, can be used without on public routes
});

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