🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@invisible/njord

Package Overview
Dependencies
Maintainers
9
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@invisible/njord

Invisible Metrics Package

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
9
Created
Source

Njord/Server

Set up Environment

You need to set the following environment variables on your .env file:

  • NODE_ENV, PORT, DB_CONNECTION_STRING, DB_TEST_CONNECTION_STRING, NJORD_API_TOKEN

How to start Njord server?

$ yarn build
$ node build/index.js

Routes

POST /api/v1/event

This route creates an event and save it to a MongoDB database.

The incoming request body should have the following parameters:

name

Type: String

metadata

Type: Object

Njord/client

How to install the client?

npm install @invisible/njord

or

yarn add @invisible/njord

API

recordEvent(options)

  • Returns a Promise for a response from Njord server.

options

interface optionsInterface {
  name: string,
  metadata: object,
}

Environment Variables

Add the following environment variables:

  • NJORD_API_TOKEN - Njord server authentication token.
  • NJORD_HOSTNAME - Njord hostname url. Ex: http://inv-njord.herokuapp.com/

Consume programmatically like below:

import { recordEvent } from '@invisible/njord/client'

[...]
// Inside some async function
  await recordEvent({ name: 'eventName', metadata: { data: 'test' } })
[...]

LICENSE

MIT

FAQs

Package last updated on 24 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts