prostgles-client
Version:
Reactive client for Postgres
47 lines (37 loc) • 1.54 kB
Markdown
# prostgles-client
Isomorphic TypeScript client for PostgreSQL
[](https://github.com/prostgles/prostgles-client-js/blob/master/LICENSE)
[](https://www.npmjs.com/package/prostgles-client)
[](https://david-dm.org/prostgles/prostgles-client-js/status.svg#info=dependencies)
[](https://snyk.io/test/github/prostgles/prostgles-client-js)

## Installation
Module
```bash
$ npm install prostgles-client socket.io-client
```
CDN
```html
<head>
<script src="https://unpkg.com/socket.io-client@3.0.3/dist/socket.io.min.js" type="text/javascript"></script>
<script src="https://unpkg.com/prostgles-client@latest/dist/index.js" type="text/javascript"></script>
</head>
```
## Usage
### Vanilla js
```js
prostgles({
socket: io(),
onReady: async (db) => {
const latest_posts = await db.posts.find({ }, { orderBy: { created: -1 } });
}
});
```
### React hooks
```tsx
const latest_posts = dbo.posts.useFind({ }, { orderBy: { created: -1 } });
const user = dbo.users.useSubscribeOne({ id: 1 });
```
[Examples](https://github.com/prostgles/prostgles-server-js/tree/master/examples)
## License
[MIT](LICENSE)