Skip to content

Commit 140a942

Browse files
committed
feat: implement trade flow logic and API endpoints (#88, #42)
1 parent 62d3a5f commit 140a942

File tree

13 files changed

+739
-28
lines changed

13 files changed

+739
-28
lines changed

.env.example

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Database Configuration
22
DATABASE_URL="postgresql://postgres:password@localhost:5432/tradeflow?schema=public"
33

4-
# Alternative Database Configuration (for TypeORM)
5-
DB_HOST=localhost
6-
DB_PORT=5432
7-
DB_USERNAME=postgres
8-
DB_PASSWORD=password
9-
DB_DATABASE=tradeflow
4+
# Redis Configuration
5+
REDIS_URL="redis://localhost:6379"
6+
7+
# Security Configuration
8+
JWT_SECRET="generate-a-safe-secret-key-here"
9+
ADMIN_PASSWORD="TradeFlow2026!"

config/redis.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Centralized Redis Client Connection
3+
* Shared across API instances for rate limiting and price caching
4+
*/
5+
const Redis = require('ioredis');
6+
7+
// In a real production deployment, this URL would come from environment
8+
const REDIS_URL = process.env.REDIS_URL || 'redis://localhost:6379';
9+
10+
const redisClient = new Redis(REDIS_URL, {
11+
maxRetriesPerRequest: null,
12+
enableReadyCheck: true
13+
});
14+
15+
redisClient.on('connect', () => {
16+
console.log('🚀 Redis Connection Established - Synchronization Active');
17+
});
18+
19+
redisClient.on('error', (err) => {
20+
console.error('⚠️ Redis Connection Failed:', err.message);
21+
});
22+
23+
module.exports = redisClient;

0 commit comments

Comments
 (0)