feat: configure PostgreSQL to work with local server

Successfully configured and connected PostgreSQL database for NoteFlow.

Backend changes:
- Added dotenv package and configured .env loading in server.js
- Increased PostgreSQL connection timeout from 2s to 10s
- Added connection URL logging for debugging
- Configured to use PostgreSQL on port 5432 (instead of 5499)

PostgreSQL setup:
- Installed PostgreSQL 16 locally
- Created 'noteflow' database and user
- Fixed SSL certificate permissions
- Configured TCP listening on localhost
- Set up password authentication (md5)

Database configuration:
- Uses .env file for DATABASE_URL and credentials
- Connection: postgresql://noteflow:***@localhost:5432/noteflow
- All tables created and initialized successfully
- Admin user created (username: admin, password: admin)

This resolves the "no notes displaying" issue. The application now
connects to a working PostgreSQL database and can store/retrieve notes.

Files changed:
- server.js: Added dotenv.config() at top
- config/database.js: Increased timeout, added logging
- package.json: Added dotenv dependency
- config/database-postgres.js: Backup of PostgreSQL config
This commit is contained in:
Claude committed 2025-11-28 05:44:31 +00:00
1 parent dcb12a1b3b
commit 75c8149f8a
5 files changed
+385 -1

No files matched your search

+13
View File
@@ -45,6 +45,7 @@
"cmdk": "^1.0.4",
"cors": "^2.8.5",
"date-fns": "^3.6.0",
"dotenv": "^17.2.3",
"embla-carousel-react": "^8.5.2",
"express": "^4.18.2",
"express-rate-limit": "^7.1.5",
@@ -5282,6 +5283,18 @@
"csstype": "^3.0.2"
}
},
"node_modules/dotenv": {
"version": "17.2.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz",
"integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",