walkerofthewoods / bgio-postgres

PostgreSQL storage adapter for boardgame.io

Home Page:https://www.npmjs.com/package/bgio-postgres

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bgio-postgres - PostgreSQL storage adapter for boardgame.io

Usage

You can use the PostgresStore in two ways. Either provide credentials using a URI as the first argument, or by using an options object.

import { Server } from "boardgame.io/server";
import { PostgresStore } from "bgio-postgres";

// EITHER provide a URI
const db = new PostgresStore("postgresql://<username>:<password>@<host>/<database>");

// OR provide options
const db = new PostgresStore({
  database: "database",
  username: "username",
  password: "password",
  host: "host",
});

const server = Server({
  games: [...],
  db,
});

Optional Parameters

This adapter uses Sequelize as the ORM. Any additional options provided to PostgresStore will be passed to the initialization arguments of the underlying Sequelize instance.

// EITHER provide options after the URI...
const db = new PostgresStore(
  "postgresql://<username>:<password>@<host>/<database>",
  {
    logging: myLogger,
    timezone: '+00:00',
  }
);

// ...OR provide addition options with the credentials.
const db = new PostgresStore({
  database: "database",
  username: "username",
  password: "password",
  host: "host",
  logging: myLogger,
  timezone: '+00:00',
});

The full list of available options is documented in the Sequelize API Docs.

About

PostgreSQL storage adapter for boardgame.io

https://www.npmjs.com/package/bgio-postgres


Languages

Language:TypeScript 74.4%Language:JavaScript 25.6%