Node.js client for the Box.com Content API.
- All File Ops
- All Folder Ops
- Events - Long Polling
The SDK aims to abstract away the intricacies of authentication, refreshing tokens, etc. as far as possible. Hence, you will not find explicit methods to perform low-level operations.
All legitimate public methods map to the high level functionality described in the Content API docs.
Install the module with:
npm install box-sdk
var box_sdk = ;var logLevel = 'debug'; //default log level on construction is info//Default host: localhostvar box = box_sdk;var connection = box;//Navigate user to the auth URLconsole;connection;
Running with Passport authentication under Express
Note: There is a complete express example in this gist.
var express =passport =BoxStrategy = Strategybox_sdk = ;...var box = box_sdk;...passport;...var app = ;...app;app;app;
var connection = box;//Navigate user to the auth URLconsole;connection
Before running your tests locally, copy
test/env.json and fill in correct values for the environment variables to be imported during testing.
phantomjs executables must be available in the enviroment path. Usually it is enough to run:
$ npm install -g phantomjs$ npm install -g casperjs
Run all tests with:
$ grunt mochaTest
The files under
test/integration are completely self-contained, and hence can be run independently. For example:
$ grunt mochaTest --target=./test/integration/api/content/folders-test.js
API documentation is generated by running:
$ grunt jsdoc
The generated documentation is available in the
dist/docs folder. An up-to-date online version is hosted at http://adityamukho.github.io/node-box-sdk/ .
Complete tutorials will soon be added to the documentation. In the meantime, have a look at the included test cases to get an idea of how the SDK is used.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2014-2015 Aditya Mukhopadhyay
Licensed under the MIT license.