![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.
nest-pgpromise
Advanced tools
pg-promise Module for Nest framework
This's a nest-pgpromise module for Nest. This quickstart guide will show you how to install and execute an example nestjs program..
This document assumes that you have a working nodejs setup in place.
npm install --save nest-pgpromise
You need five items in order to connect to MinIO object storage server.
Params | Description |
---|---|
host | Host address. |
port | TCP/IP port number. |
database | The name of db to connect to. |
username | The username to access db. |
password | The username's password |
Provide the credentials for minio module by importing it as :
import { Module } from '@nestjs/common';
import { NestPgpromiseClientController } from './nest-pgpromise-client.controller';
import { NestPgpromiseModule } from '../nest-pgpromise.module';
@Module({
controllers: [NestPgpromiseClientController],
imports: [
NestPgpromiseModule.register({
connection: {
host: 'localhost',
port: 5432,
database: 'cmdbbtbi',
user: 'cmadbbtbi',
password: 'cghQZynG0whwtGki-ci2bpxV5Jw_5k6z',
},
}),
],
})
});
import { Module } from '@nestjs/common';
import { NestPgpromiseClientController } from './nest-pgpromise-client.controller';
import { NestPgpromiseModule } from '../nest-pgpromise.module';
@Module({
controllers: [NestPgpromiseClientController],
imports: [
NestPgpromiseModule.register({
connection:"postgres://YourUserName:YourPassword@YourHost:5432/YourDatabase"
}),
],
})
});
Then you can use it in the controller or service by injecting it in the controller as:
constructor(@Inject(NEST_PGPROMISE_CONNECTION) private readonly pg) {
This example program connects to postgres on localhost and executes a simple select
query from table tasks
.
import { Controller, Get, Inject, Logger } from '@nestjs/common';
import { NEST_PGPROMISE_CONNECTION } from '../constants';
@Controller()
export class NestPgpromiseClientController {
private logger = new Logger('controller');
constructor(@Inject(NEST_PGPROMISE_CONNECTION) private readonly pg) {}
@Get()
async index() {
this.pg
.any('SELECT * FROM task')
.then(data => {
// success;
this.logger.log(data);
})
.catch(error => {
// error;
this.logger.log(error);
});
}
}
You can also pass in initoptions
as supported by pg-promise.
import { Module } from '@nestjs/common';
import { NestPgpromiseClientController } from './nest-pgpromise-client.controller';
import { NestPgpromiseModule } from '../nest-pgpromise.module';
@Module({
controllers: [NestPgpromiseClientController],
imports: [
NestPgpromiseModule.register({
connection: {
host: 'localhost',
port: 5432,
database: 'cmdbbtbi',
user: 'cmadbbtbi',
password: 'cghQZynG0whwtGki-ci2bpxV5Jw_5k6z',
},
initOptions:{/* initialization options */};
}),
],
})
});
You can find the details about them in the pg-promise documentation
FAQs
Unknown package
We found that nest-pgpromise 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.