@cemiltokatli/node-data
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "@cemiltokatli/node-data", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Database helper library that provides classes and methods for you to query MySQL database.", | ||
@@ -5,0 +5,0 @@ "keywords": ["database", "mysql", "node", "data", "sql", "query"], |
@@ -146,3 +146,36 @@ # Node Data | ||
## Installation | ||
You can install `node-data` with the following `npm` command: | ||
``` | ||
npm i @cemiltokatli/node-data | ||
``` | ||
## Usage | ||
### Creating a connection pool | ||
``` | ||
import Database from '@cemiltokatli/node-data/Database' | ||
const database = new Database({ | ||
host: 'localhost', | ||
port: 3306, | ||
user: 'root', | ||
password: 'root', | ||
database: 'mydatabase', | ||
}) | ||
``` | ||
Then, you can retrieve a new database connection from the pool: | ||
``` | ||
const connection = await database.getConnection() | ||
// database operations... | ||
connection.release() | ||
``` | ||
Please check the [sample project](https://github.com/cemiltokatli/node-data-sample) folder for usage examples. |
26471
181