added example .env

This commit is contained in:
slawk0
2024-08-26 20:39:04 +02:00
parent 135b8449ea
commit 323d4f0661
3 changed files with 33 additions and 18 deletions

7
.env Normal file
View File

@@ -0,0 +1,7 @@
PG_HOST=db
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=changeme
PG_DATABASE=webchat
SESSION_SECRET=changeme
JWT_SECRET=changeme

1
.gitignore vendored
View File

@@ -1,4 +1,3 @@
node_modules/
.idea
package-lock.json
.env

View File

@@ -15,6 +15,8 @@ db.connect()
.catch((err) => console.log('Error on connecting to database: ', err));
async function createTables() {
try {
// Create accounts table
await db.query(`
CREATE TABLE IF NOT EXISTS accounts (
id SERIAL PRIMARY KEY,
@@ -32,7 +34,14 @@ async function createTables() {
recipient VARCHAR(255) NOT NULL
)
`);
console.log('Tables created successfully');
} catch (err) {
console.error('Error creating tables:', err);
throw err;
}
}
createTables()
.catch((err) => {
console.error('Error creating tables:', err);