README.MD 825 Bytes
Newer Older
Milan Wikarski's avatar
Milan Wikarski committed
1
# js-db
Marcel's avatar
again    
Marcel committed
2

Milan Wikarski's avatar
Milan Wikarski committed
3
Module used for communication between NodeJS and PostgreSQL.
4
5
6

## Creating DB instance

Milan Wikarski's avatar
Milan Wikarski committed
7
To create a new DB instance call DB constructor.
8

Milan Wikarski's avatar
Milan Wikarski committed
9
10
11
```javascript
const DB = require('@creanet/js-db');
const db = new DB(params);
12
13
14
15
16
17
18
19
20
21
22
```

The constructor requires parameters necessary to create connection with db:

| Parameter    | Description                         | Example          |
| ------------ | ----------------------------------- | ---------------- |
| **user**     | The user of the DB                  | lorem            |
| **database** | The name of the DB                  | ipsum            |
| **password** | The password of the user            | dolor.sit.amet   |
| **host**     | The host of the DB                  | db.websupport.sk |
| **port**     | The port to be used when connecting | 1234             |