luno-node
Use the Luno API in Node.js
This module is a very thin wrapper on the Luno API, handling authentication, request signing and errors.
Install
npm install --save luno
Usage
For documentation on all methods and routes, please see our docs.
var Luno = ;var luno = key: 'YOUR-API-KEY' // Your Luno API key secret: 'YOUR-SECRET-KEY' // Your Luno secret key timeout: 10000 // Maximum request timeout (in milliseconds). Default 10000. sandbox: false // Set to true to enable Sandbox Mode for all requests (unless otherwise specified in params). See https://luno.io/docs#sandbox; luno;
Methods
GET, POST, PUT, PATCH, DELETE and request.
// GET// luno.get(route, query, callback);luno; // POST// luno.post(route, query, body, callback);luno; // PUT// luno.put(route, query, body, callback);luno; // PATCH// luno.patch(route, query, body, callback);luno; // DELETE// luno.delete(route, query, callback);luno; // REQUEST (any method)// luno.request(METHOD, route, query, body, callback);luno;
Middleware
Use the session middleware to quickly ensure a session is valid and fetch the details.
It'll set req.session
to the session details (if the session is valid) and req.user
to the user details (if the session is valid and there is an associated user).
// app is an express server app; // admin section of the app requires the session to be valid// and to have an associated userapp; app; app;
Registration
Let a user sign up and log them in.
Note: you may want to look at Luno CSRF to add CSRF protection using Luno.
app; app;