'nodejs pg split read/write request to database
My work is based on nodejs and using
const { Pool } = require('pg');
const pool = new Pool({
user: process.env.USER,
host: process.env.HOST,
port: 5432,
database: "database1",
password: password,
});
const knex = require('knex')({ client: 'pg' });
knex
.select('u.user_id')
.from({ u: 'User' })
There are 2 databases in each aws RDS
- master
- replica-master
I want knex.select uses replica-master database and write user master. How could I configure this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
