Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 1.5 KB

README.md

File metadata and controls

46 lines (37 loc) · 1.5 KB

prostgles-client

Isomorphic TypeScript client for PostgreSQL

GitHub license npm version Dependency Status Known Vulnerabilities Tests

Installation

Module

$ npm install prostgles-client socket.io-client

CDN

<head>
    <script src="https://unpkg.com/[email protected]/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

prostgles({
  socket: io(), 
  onReady: async (db) => {
    const latest_posts = await db.posts.find({ }, { orderBy: { created: -1 } });
  }
});

React hooks

const latest_posts = dbo.posts.useFind({ }, { orderBy: { created: -1 } });
const user = dbo.users.useSubscribeOne({ id: 1 });

Examples

License

MIT