bipulsardar421 commited on
Commit
6320560
·
1 Parent(s): 3dbfa56
Files changed (4) hide show
  1. .gitignore +1 -0
  2. package-lock.json +13 -0
  3. package.json +2 -1
  4. server.ts +2 -2
.gitignore CHANGED
@@ -1 +1,2 @@
1
  /node_modules
 
 
1
  /node_modules
2
+ .env
package-lock.json CHANGED
@@ -9,6 +9,7 @@
9
  "version": "1.0.0",
10
  "license": "ISC",
11
  "dependencies": {
 
12
  "express": "^5.1.0",
13
  "pg": "^8.16.3"
14
  },
@@ -485,6 +486,18 @@
485
  "node": ">=0.3.1"
486
  }
487
  },
 
 
 
 
 
 
 
 
 
 
 
 
488
  "node_modules/dunder-proto": {
489
  "version": "1.0.1",
490
  "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
 
9
  "version": "1.0.0",
10
  "license": "ISC",
11
  "dependencies": {
12
+ "dotenv": "^17.2.2",
13
  "express": "^5.1.0",
14
  "pg": "^8.16.3"
15
  },
 
486
  "node": ">=0.3.1"
487
  }
488
  },
489
+ "node_modules/dotenv": {
490
+ "version": "17.2.2",
491
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.2.tgz",
492
+ "integrity": "sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==",
493
+ "license": "BSD-2-Clause",
494
+ "engines": {
495
+ "node": ">=12"
496
+ },
497
+ "funding": {
498
+ "url": "https://dotenvx.com"
499
+ }
500
+ },
501
  "node_modules/dunder-proto": {
502
  "version": "1.0.1",
503
  "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
package.json CHANGED
@@ -14,6 +14,7 @@
14
  "license": "ISC",
15
  "type": "commonjs",
16
  "dependencies": {
 
17
  "express": "^5.1.0",
18
  "pg": "^8.16.3"
19
  },
@@ -25,4 +26,4 @@
25
  "ts-node": "^10.0.0",
26
  "typescript": "^5.0.0"
27
  }
28
- }
 
14
  "license": "ISC",
15
  "type": "commonjs",
16
  "dependencies": {
17
+ "dotenv": "^17.2.2",
18
  "express": "^5.1.0",
19
  "pg": "^8.16.3"
20
  },
 
26
  "ts-node": "^10.0.0",
27
  "typescript": "^5.0.0"
28
  }
29
+ }
server.ts CHANGED
@@ -2,6 +2,7 @@ import express, { Request, Response } from "express";
2
  import { Pool } from "pg";
3
  import fs from "fs";
4
  import path from "path";
 
5
 
6
  const app = express();
7
  const port = 3000;
@@ -19,8 +20,7 @@ try {
19
  }
20
 
21
  const pool = new Pool({
22
- connectionString:
23
- "postgres://avnadmin:AVNS_BsUJEz_hcswptIqk5yR@postgres-bs-bebb.l.aivencloud.com:21759/defaultdb",
24
  ssl: {
25
  ca: caCert,
26
  rejectUnauthorized: true,
 
2
  import { Pool } from "pg";
3
  import fs from "fs";
4
  import path from "path";
5
+ import "dotenv/config";
6
 
7
  const app = express();
8
  const port = 3000;
 
20
  }
21
 
22
  const pool = new Pool({
23
+ connectionString: `postgres://${process.env.UNAME}:${process.env.PWD}@postgres-bs-bebb.l.aivencloud.com:21759/defaultdb`,
 
24
  ssl: {
25
  ca: caCert,
26
  rejectUnauthorized: true,