Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

directus-sdk-node

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directus-sdk-node

A JavaScript client for the Directus API

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

Directus SDK for Node

For Node driven apps, use this SDK to more easily communicate with your Directus managed database through the API.

Work in progress

Install

npm install directus-sdk-node

Usage

Directus Hosted

const client = new DirectusSDK('user-token', {
  // the sub-domain in your instance url
  instanceKey: 'user--instance'
});

client.getEntries('articles', (err, res) => {
  if(err) throw err;
  res.forEach((article) => {
    console.log(article.title);
  });
});

Own Server

const client = new DirectusSDK('user-token', {
  baseUrl: 'http://yoursite.com/api',
  apiVersion: 1 // Optional - default 1
});

client.getEntries('articles', (err, res) => {
  if(err) throw err;
  res.forEach((article) => {
    console.log(article.title);
  });
});

Supported Methods / Endpoints

All methods can be used with either callbacks or promises

For more info on what parameters are supported: check the official Directus API docs

client.getTables([Function callback]);
client.getTable(String table, [Function callback]);
client.getColumns(String table, [Object params, Function callback]);
client.getColumn(String table, String column, [Function callback]);
client.getEntries(String table, [Object params, Function callback]);
client.getEntry(String table, Number id, [Object params, Function callback]);
client.createEntry(String table, Object data, [Function callback]);
client.updateEntry(String table, Number id, Object data, [Function callback]);
client.deleteEntry(String table, Number id, [deleteFromDB: Boolean = false, Function callback]);
client.getUser([Object params, Function callback]);
client.getUser(Number id, [Object params, Function callback]);
client.createUse(Object data, [Function callback]);
client.updateUser(Number id, Object data, [Function callback]);
client.deleteUser(Number id, [deleteFromDB: Boolean = false, Function callback]);
client.getGroup([Object params, Function callback]);
client.getGroup(Number id, [Object params, Function callback]);
client.getGroupPrivileges(Number id, [Function callback]);
client.getFile([Object params, Function callback]);
client.getFile(Number id, Object params, Function callback]);
client.createFile(Object data, [Function callback]);
client.updateFile(Number id, Object data, [Function callback]);
client.deleteFile(Number id, [deleteFromDB: Boolean = false, Function callback]);
client.getSettings([Function callback]);
client.getSettingsByCollection(String collectionName, [Function callback]);

FAQs

Package last updated on 15 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc