Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 716f403

Browse files
authored
Update README.md
1 parent f754d5e commit 716f403

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

README.md

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1-
# Database-js
1+
# database-js
22

33
[![Build Status](https://travis-ci.org/mlaanderson/database-js.svg?branch=master)](https://travis-ci.org/mlaanderson/database-js)
44
[![npm version](https://badge.fury.io/js/database-js.svg)](https://badge.fury.io/js/database-js)
55
[![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
66

7-
* [Install](#install)
8-
* [API](//github.com/mlaanderson/database-js/wiki/API)
9-
* [Examples](//github.com/mlaanderson/database-js/wiki/Examples)
10-
* [Drivers](//github.com/mlaanderson/database-js/wiki/Drivers)
11-
* [In the Browser](//github.com/mlaanderson/database-js/wiki/Browsers)
12-
13-
## About
7+
> Wrapper for multiple databases with a JDBC-like connection
148
159
Database-js was started to implement a common, promise-based interface for SQL database access. The concept is to copy the Java pattern of using connection strings to identify the driver. Then provide wrappers around the implemented functionality to commonize the syntax and results.
1610

1711
Thus if SQLite, MySQL and PostgreSQL all have a database named test with a table named states we can access the data the same way.
1812

1913
Database-js has built-in prepared statements, even if the underlying driver does not support them. It is built on Promises, so it works well with ES7 async code.
2014

15+
## Contents
16+
17+
* [Install](#install)
18+
* [Usage](#usage)
19+
* [Examples](//github.com/mlaanderson/database-js/wiki/Examples)
20+
* [API](//github.com/mlaanderson/database-js/wiki/API)
21+
* [Drivers](//github.com/mlaanderson/database-js/wiki/Drivers)
22+
* [In the Browser](//github.com/mlaanderson/database-js/wiki/Browsers)
23+
24+
## Install
25+
26+
```shell
27+
npm install database-js
28+
```
29+
2130
## Drivers
2231

2332
Currently available drivers:
@@ -33,12 +42,6 @@ Currently available drivers:
3342

3443
[See here](https://github.com/mlaanderson/database-js/wiki/Drivers#implementing-a-new-driver) how to add a new driver.
3544

36-
## Install
37-
38-
```shell
39-
npm install database-js
40-
```
41-
4245
## Usage
4346

4447
```javascript
@@ -49,7 +52,7 @@ var conn =
4952
new Connection("sqlite:///path/to/test.sqlite"); // SQLite
5053
// new Connection("mysql://user:password@localhost/test"); // MySQL
5154
// new Connection("postgres://user:password@localhost/test"); // PostgreSQL
52-
// another database here (see the drivers)
55+
// new Connection( < ANOTHER URL HERE > ); // see the drivers
5356

5457
var statement = conn.prepareStatement("SELECT * FROM states WHERE state = ?");
5558
statement.query("South Dakota")
@@ -77,6 +80,7 @@ statement.query("South Dakota")
7780
```
7881

7982
### Async / await
83+
8084
Because **database-js** is built on Promises, it works very well with [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/async_function). Compare the following code to the code from above. They accomplish the same thing.
8185
```javascript
8286
var Connection = require('database-js').Connection;

0 commit comments

Comments
 (0)