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

node-directus-client

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-directus-client - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

92

package.json
{
"name": "node-directus-client",
"version": "0.4.1",
"description": "A JavaScript client for the Directus API",
"main": "index.js",
"scripts": {
"build": "webpack --config webpack.config.js"
"_args": [
[
{
"raw": "node-directus-client",
"scope": null,
"escapedName": "node-directus-client",
"name": "node-directus-client",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"/Users/rijkvanzanten/Desktop/test"
]
],
"_from": "node-directus-client@latest",
"_id": "node-directus-client@0.4.1",
"_inCache": true,
"_installable": true,
"_location": "/node-directus-client",
"_nodeVersion": "6.7.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/node-directus-client-0.4.1.tgz_1478816011326_0.025797634618356824"
},
"repository": {
"type": "git",
"url": "git+https://github.com/RijkvanZanten/node-directus-client.git"
"_npmUser": {
"name": "rijkvanzanten",
"email": "rijkvanzanten@me.com"
},
"keywords": [],
"author": "Rijk van Zanten",
"license": "MIT",
"_npmVersion": "3.10.3",
"_phantomChildren": {},
"_requested": {
"raw": "node-directus-client",
"scope": null,
"escapedName": "node-directus-client",
"name": "node-directus-client",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/node-directus-client/-/node-directus-client-0.4.1.tgz",
"_shasum": "9e7ce905e93e7a1e63d6db0260f84420b05e5cd0",
"_shrinkwrap": null,
"_spec": "node-directus-client",
"_where": "/Users/rijkvanzanten/Desktop/test",
"author": {
"name": "Rijk van Zanten"
},
"bugs": {
"url": "https://github.com/RijkvanZanten/node-directus-client/issues"
},
"homepage": "https://github.com/RijkvanZanten/node-directus-client#readme",
"dependencies": {

@@ -25,2 +60,4 @@ "q": "^1.4.1",

},
"deprecated": "Use directus-sdk-node",
"description": "A JavaScript client for the Directus API",
"devDependencies": {

@@ -31,3 +68,30 @@ "babel-core": "^6.18.2",

"webpack-node-externals": "^1.5.4"
}
},
"directories": {},
"dist": {
"shasum": "9e7ce905e93e7a1e63d6db0260f84420b05e5cd0",
"tarball": "https://registry.npmjs.org/node-directus-client/-/node-directus-client-0.4.1.tgz"
},
"gitHead": "8ed54fdff0ba293da16e7e3b05f68a49ef8c2e52",
"homepage": "https://github.com/RijkvanZanten/node-directus-client#readme",
"keywords": [],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "rijkvanzanten",
"email": "rijkvanzanten@me.com"
}
],
"name": "node-directus-client",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/RijkvanZanten/node-directus-client.git"
},
"scripts": {
"build": "webpack --config webpack.config.js"
},
"version": "0.5.0"
}

85

README.md
# Directus API JavaScript Client
A JavaScript client for the Directus API
This library is **under active development**. Breaking changes can occur at every patch.
## Purpose
This libraries abstracts the interaction with the Directus CMS API. It enables your Node.js app to request specific resources from a Directus instance.
## Installation
To use the library, install it with npm:
`npm install --save node-directus-client`
Then require it in your application script:
`const DirectusSDKClient = require('node-directus-client')`
## Usage
The module is a class, so you'll have to create a new instance of the client bound to the endpoint and access token of your Directus instance. This can either be a self-hosted Directus installation or a hosted Directus instance.
Self-hosted
```javascript
const client = new DirectusSDKClient('apiKey-12345', {
baseURL: 'http://yoursite.com/api/'
});
```
Hosted
```javascript
const client = new DirectusSDKClient('apiKey-12345', {
instanceKey: 'instance_key'
});
```
Every method (see below) is asynchronous and can be used with callbacks as well as promises.
```javascript
client.getTables()
.then((res) => {
console.log(res);
});
client.getTables(function(err, res) {
console.log(res);
});
```
## Methods (endpoints)
The options object will be converted to query params in the api request. Check [the official Directus API endpoints docs](http://getdirectus.com/api/overview/endpoints) for all available options.
### getTables
```javascript
client.getTables([_obj_ options, _fn_ callback])
```
Get all available tables.
### getColumns
```javascript
client.getColumns(_string_ table, [_obj_ options, _fn_ callback])
```
Get all columns from a single table.
### getEntry
```javascript
client.getEntry(_string_ table, _int_ id, [_obj_ options, _fn_ callback])
```
Get a single item from a table
### getEntries
```javascript
client.getEntries(_string_ table, [_obj_ options, _fn_ callback])
```
Get multiple items from a table
### getUser
```javascript
client.getUser(_int_ id, [_obj_ options, _fn_ callback])
```
Get a single user
### getUsers
```javascript
client.getUsers([_obj_ options, _fn_ callback])
```
Get all users
**More methods will be added over time, including methods to update and post entries**
> This package has been **deprecated**. Please use [directus-sdk-node](http://npmjs.com/package/directus-sdk-node/) instead.
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