UNPKG

@nzz/q-server

Version:

__Q__ is a system that lets journalists create visual elements for stories. It is developed by [NZZ Storytelling](https://www.nzz.ch/storytelling) and used in the [NZZ](https://www.nzz.ch) newsroom.

21 lines (18 loc) 410 B
const nano = require('nano') var db; module.exports.connect = function(config) { const dbUrl = `${config.protocol || 'https'}://${config.host}/${config.database}`; console.log(`Connecting to database ${dbUrl}`); db = nano({ url: dbUrl, requestDefaults: { auth: { user: config.user, pass: config.pass } } }) } module.exports.getDb = function() { return db; }