@invisible/njord

0.0.3 • Public • Published

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

Dependents (0)

Package Sidebar

Install

npm i @invisible/njord

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

195 kB

Total Files

40

Last publish

Collaborators

  • brittonware
  • juliendemarque
  • chancellorrr
  • adamhaney-invisible
  • nadeeminv
  • gtaltemann
  • elseagle
  • invisible-bot
  • rodrigo4244
  • scottdownes
  • zacksingh
  • el5091