0.0.20 • Published 2 years ago

grapherjs v0.0.20

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

npm

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
0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago