grapherjs v0.0.20
node-grapherjs
A client implementation for Grapherjs in node.js. Check out Grapherjs's Node logging documentation for more.
Usage
The node-grapherjs library is compliant with the Grapherjs API. Using node-grapherjs is easy for a variety of scenarios: logging, working with devices and inputs, searching, and facet searching.
Getting Started
import Grapherjs from "grapherjs";
const client = new Grapherjs({
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
});
Logging Middleware
import express from "express";
import Grapherjs from "grapherjs";
const app = express();
const client = new Grapherjs({
client_id: process.env.CLIENT_ID,
client_secret: process.env.CLIENT_SECRET,
});
app.use(client.tracingHandler()); // Place this before the start of the express routes.
...
app.use(client.errorHandler()); // Place this at the end of your express routes.
Custom Logging
There are two ways to send log information to Grapherjs via node-grapherjs. The first is to simply call client.log with an appropriate input token:
client.log(req, res, { data: "custom log data" }, (data) => {
// Callback
});
Note that the callback in the above example is optional, if you prefer the 'fire and forget' method of logging:
client.log(req, res, { data: "custom log data" });
Installation
# Using npm
npm install grapherjs
# Using yarn
yarn add grapherjs
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago