@dekproject/pg

1.2.2 • Public • Published

@dekproject/PostgreSQL

PostgreSQL interface plugin for DEK

What does this plugin do?

  • Control configuration for connection to PostgreSQL in production development mode in a simplified way with dotenv
  • Performs connection implementation along the lines ES6 being pre requirement to start the project

Instalation

To install the bootstrap we recommend using the CLI

$ yarn add @dekproject/pg --save
$ nano .env

In the .env file add the following settings

PG_USER=root
PG_PASSWORD=
PG_HOST=localhost
PG_PORT=27017
PG_DB=dek

Usage

Using direct

$ yarn @dekproject/scope --save

Using in the standard DEK skeleton

import { $, app, pg } from "@dekproject/scope";

app.get("user", (req, res) => {
    pg.query('SELECT $1::text as message', ['Hello world!'], (err, res) => {
        if(err) res.status(500).send(err).end();
        else res.send(res).end();
    })
});

$.wait("pg").then(() => {
    app.listen(PORT, () => {
        console.log(`App listening on port ${PORT}!`);
    });
});

Readme

Keywords

Package Sidebar

Install

npm i @dekproject/pg

Weekly Downloads

2

Version

1.2.2

License

MIT

Unpacked Size

12.6 kB

Total Files

7

Last publish

Collaborators

  • gislainyvelasco
  • andrehrf