![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
PostgresSQL client to Nodejs servers
Did you like the project? Please, considerate a donation to help improve!
PostgresSQL client to Nodejs servers✨
Connect your database easily using the pgnode package
To install the module in your project just run the command below:
npm i pgnode
or
yarn add pgnode
Now in your project just import the module like this:
const pg = require("pgnode");
Or you can use import:
import pg from "pgnode";
This is the simplest possible way to connect, query, and disconnect with async/await:
import pg, { Client, Pool } from "pgnode";
const config = {
user: process.env.POSTGRES_USER,
host: process.env.POSTGRES_HOST,
database: process.env.POSTGRES_DATABASE,
password: process.env.POSTGRES_PASSWORD,
port: Number(process.env.POSTGRES_PORT),
};
const client = new pg.Client({ ...config });
function query(sql, params) {
return client
.connect()
.then(() => client.query(sql, params))
.then((res) => {
client.end();
return res;
});
}
import {tx, Client, Pool} from 'pgnode';
const client = new Client({
user: process.env.POSTGRES_USER,
host: process.env.POSTGRES_HOST,
database: process.env.POSTGRES_DATABASE,
password: process.env.POSTGRES_PASSWORD,
port: Number(process.env.POSTGRES_PORT)
});
const pool = new Pool({...client});
export async function createTable(){
return await tx(pool, async (db) => {
await db.query(`
CREATE TABLE IF NOT EXISTS test
(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL
);`);
});
}
// or use a generator function to create the transactions
export function* createTableGenerator(){
yield tx(pool, async (db) => {
await db.query(`
CREATE TABLE IF NOT EXISTS test
(
id SERIAL PRIMARY KEY,
name TEXT NOT NULL
);`);
});
// create another transaction
yield tx(pool, async (db) => {
await db.query(`
INSERT INTO test (name) VALUES ('test');`);
});
}
tls.connect
options being passed to the client/pool constructor under the ssl
option.LISTEN/NOTIFY
COPY TO/COPY FROM
pg.Client
and pg.Pool
are ES6 classespg.Client.prototype.query
and pg.Pool.prototype.query
^v16x
FAQs
PostgresSQL client to Nodejs servers
The npm package pgnode receives a total of 8 weekly downloads. As such, pgnode popularity was classified as not popular.
We found that pgnode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.