🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

pg-client

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-client

Promise-based wrapper for node-postgres library designed for easy use with ES7 async/await.

0.0.5
latest
Source
npm
Version published
Weekly downloads
21
-25%
Maintainers
1
Weekly downloads
 
Created
Source

ES7 Async/Await Client for PostgreSQL

NPM version NPM downloads Build Status Dependency Status DevDependency Status

Promise-based wrapper for node-postgres library designed for easy use with ES7 async/await.

How to Install

$ npm install pg-client --save

Getting Started

Usage sample in a Node.js/Express web app:

import db from 'pg-client';
import { Router } from 'express';
import { connectionString } from '../config';

const router = new Router();

router.get('/users', (req, res, next) => {
  db.connect(connectionString, async ({ query }) => {
    const result = await query('SELECT id, email FROM users WHERE id = $1', 123);
    if (result.rowCount) {
      res.send(result.rows[0]);
    } else {
      res.sendStatus(404);
    }
  }).catch(next);
});

export default router;
  • Membership Database — SQL database schema boilerplate for building web apps
  • React Starter Kit — Isomorphic web app boilerplate

License

The MIT License © 2016 Kriasoft, LLC. All rights reserved. Made with ♥ by Konstantin Tarkus (@koistya) and contributors

Keywords

pg

FAQs

Package last updated on 25 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts