add .env.example and increase file size
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
PORT=3000
|
||||
|
||||
DB_STRYKER_HOST=127.0.0.1
|
||||
DB_STRYKER_PORT=5432
|
||||
DB_STRYKER_DATABASE=
|
||||
DB_STRYKER_USER=
|
||||
DB_STRYKER_PASSWORD=
|
||||
|
||||
DB_BECKMAN_HOST=127.0.0.1
|
||||
DB_BECKMAN_PORT=5432
|
||||
DB_BECKMAN_DATABASE=
|
||||
DB_BECKMAN_USER=
|
||||
DB_BECKMAN_PASSWORD=
|
||||
@@ -11,7 +11,7 @@ const PORT = process.env.PORT || 3000;
|
||||
|
||||
// Middleware
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
app.use(express.json({ limit: '10mb' }));
|
||||
|
||||
// PostgreSQL connection pool
|
||||
function handleHeaders(headers) {
|
||||
@@ -155,10 +155,11 @@ app.post('/api/postgres/transaction', async (req, res) => {
|
||||
}
|
||||
|
||||
let pool;
|
||||
const client = await pool.connect();
|
||||
|
||||
let client;
|
||||
try {
|
||||
pool = handleHeaders(req.headers);
|
||||
pool = handleHeaders(req.headers);
|
||||
client = await pool.connect();
|
||||
|
||||
await client.query('BEGIN');
|
||||
|
||||
const results = [];
|
||||
@@ -177,16 +178,15 @@ app.post('/api/postgres/transaction', async (req, res) => {
|
||||
results: results
|
||||
});
|
||||
} catch (error) {
|
||||
await client.query('ROLLBACK');
|
||||
if (client) await client.query('ROLLBACK');
|
||||
console.error('TRANSACTION Error:', error);
|
||||
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
error: error.message
|
||||
});
|
||||
} finally {
|
||||
client.release();
|
||||
if (pool) await pool.end();
|
||||
if (client) client.release();
|
||||
if (pool) await pool.end();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user