2.4.1 • Published 1 month ago

@niledatabase/server v2.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@niledatabase/server

Consolidates the API and DB for working with Nile.

Usage

With configuration object

import Nile from '@niledatabase/server';

const nile = await Nile({
  user: 'username',
  password: 'password',
});

await nile.api.createTenant({ name: 'name' });

await nile.db.query('select * from todo');

With env vars

NILEDB_USER=username
NILEDB_PASSWORD=password
import Nile from '@niledatabase/server';

const nile = await Nile();

await nile.api.createTenant({ name: 'name' });

await nile.db.query('select * from todo');

Initialization

In addition to user and password, a fully configured SDK must also have values for db.host, databaseName, and databaseId. If the values are not provided in either the .env file or the instance configuration, the init() function should be called, which will allow the SDK to automatically configure itself. For production, it is recommended to set those values.

Configuration

Configuration passed to Server takes precedence over .env vars.

PropertyType.env varDescription
userstringNILEDB_USERRequired. Username for database authentication.
passwordstringNILEDB_PASSWORDRequired. Password for database authentication.
databaseIdstringNILEDB_IDID of the database.
databaseNamestringNILEDB_NAMEName of the database.
tenantIdstringNILEDB_TENANTID of the tenant associated.
userIdstringID of the user associated.
dbPoolConfigConfiguration object for pg.Pool.
db.hoststringNILEDB_HOSTBase host for DB. Defaut is db.thenile.dev
apiobjectConfiguration object for API settings.
api.basePathstringNILEDB_API_URLBase host for API for a specific region.
api.cookieKeystringKey for API cookie. Default is token.
api.tokenstringNILEDB_TOKENToken for API authentication. Mostly for debugging.
debugbooleanFlag for enabling debug logging.
2.4.0-alpha.0

1 month ago

2.4.0-alpha.1

1 month ago

2.4.1-alpha.0

1 month ago

2.4.1

1 month ago

2.3.2

1 month ago

2.4.0

1 month ago

2.3.2-alpha.0

1 month ago

2.3.1

1 month ago

2.3.0-alpha.3

1 month ago

2.3.0-alpha.4

1 month ago

2.3.0-alpha.2

1 month ago

2.3.0-alpha.1

1 month ago

2.2.1-alpha.0

1 month ago

2.3.0

1 month ago

2.2.1

1 month ago

2.3.0-alpha.0

1 month ago

2.2.0

1 month ago

2.2.0-alpha.0

1 month ago

2.2.0-alpha.3

1 month ago

2.2.0-alpha.2

1 month ago

2.2.0-alpha.1

1 month ago

2.1.2-alpha.1

1 month ago

2.1.2-alpha.0

1 month ago

2.1.1

1 month ago

2.1.1-alpha.0

1 month ago

2.1.1-alpha.2

1 month ago

2.1.0

2 months ago

2.1.1-alpha.1

1 month ago

1.0.0

2 months ago

1.0.0-alpha.202

2 months ago

1.0.0-alpha.201

2 months ago

1.0.0-alpha.200

6 months ago

1.0.0-alpha.199

7 months ago

1.0.0-alpha.198

7 months ago

1.0.0-alpha.197

7 months ago

1.0.0-alpha.196

7 months ago

1.0.0-alpha.195

7 months ago