How to use the @dadi/api.Config function in @dadi/api

To help you get started, we’ve selected a few @dadi/api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dadi / api / utils / create-client.js View on Github external
#! /usr/bin/env node

'use strict'

const path = require('path')

let Connection
let config

try {
  Connection = require('@dadi/api').Connection
  config = require('@dadi/api').Config
} catch (err) {
  Connection = require(path.join(__dirname, '/../dadi/lib/model/connection'))
  config = require(path.join(__dirname, '/../config'))
}

const clientCollectionName = config.get('auth.clientCollection')
const dbOptions = { override: true, database: config.get('auth.database'), collection: clientCollectionName }
const connection = Connection(dbOptions, config.get('auth.datastore'))

const prompt = require('cli-prompt')

let connected = false

// Temporarily restore original console
delete console.log

@dadi/api

A high performance RESTful API layer designed in support of API-first development and the principle of COPE.

SEE LICENSE IN GPL.md
Latest version published 3 months ago

Package Health Score

70 / 100
Full package analysis

Popular @dadi/api functions

Similar packages