How to use the decentraland-server.db.clients function in decentraland-server

To help you get started, we’ve selected a few decentraland-server 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 decentraland / agora / src / database / database.ts View on Github external
import { db } from 'decentraland-server'
import { env } from 'decentraland-commons'

const pg = db.clients.postgres

export const database: typeof pg = Object.create(pg)

database.connect = async () => {
  const CONNECTION_STRING = env.get('CONNECTION_STRING', undefined)
  this.client = await pg.connect(CONNECTION_STRING)
  return this
}