add vault and mongo db with postgres in comments
This commit is contained in:
16
vault/src/app.ts
Normal file
16
vault/src/app.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import express from 'express'
|
||||
import { buildClient } from './db'
|
||||
|
||||
const app = express()
|
||||
|
||||
const dbClient = buildClient('db', 'rushvault', 'rushvault', 'rushvault')
|
||||
|
||||
app.get('/api/person', async (req, res) => {
|
||||
res.status(200).send('potato!')
|
||||
})
|
||||
|
||||
app.listen(8080, async () => {
|
||||
console.log('starting on 8080')
|
||||
dbClient.connect()
|
||||
console.log(await dbClient.query('SELECT NOW()'))
|
||||
})
|
||||
24
vault/src/db.ts
Normal file
24
vault/src/db.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Client } from 'pg'
|
||||
|
||||
export function buildClient(
|
||||
host: string,
|
||||
user: string,
|
||||
password: string,
|
||||
database: string,
|
||||
) {
|
||||
return new Client({ user, password, host, database })
|
||||
}
|
||||
|
||||
// export class VaultDbClient {
|
||||
// client: Client
|
||||
|
||||
// constructor(
|
||||
// host: string,
|
||||
// port: number,
|
||||
// user: string,
|
||||
// password: string,
|
||||
// database: string,
|
||||
// ) {
|
||||
// this.client = new Client({ user, password, host, port, database })
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user