This provides utility functions to use hull.io APIs within Node.js apps.
var hull = require('hull')
hull.conf({
appId: 'YOUR_HULL_APP_ID',
orgUrl: 'YOUR_HULL_ORG_URL',
appSecret: 'YOUR_HULL_APP_SECRET'
});
// Instanciates a client for the API
var client = hull.client();
hull.conf(obj)
: Returns the global configuration or sets it if an object is given. It's mostly a helper to avoid the necessity of specifying the configuration everytime it is needed.hull.utils.signUserData(userJson/*, appSecret*/)
: Creates a signed id for the user passed in parameter. It allows to connect your own users to hull.io services.hull.utils.checkSignedUserId(userId, userSig/*, appSecret*/)
: Checks the validity of the signature relatively to a user idhull.middleware(/*appId, appSecret, deserializer*/)
: Generates a middleware to add to your Connect/Express apps. It will check if a user is onnected.hull.client()
: Instanciates an HTTP client to hull.io APIs.
Once you have instanciated a client, you can use one of the get
, post
, put
or delete
methods to perform actions of our APIs.
The first parameter is the route, the second is the set of parameters you want to send with the request, the third is a callback.
We have built a demo that uses this library, check out hull_userbase.
Also check out the API documentation to learn what you can achieve with our APIs.
MIT