backend changes
This commit is contained in:
parent
f3077d53a7
commit
1c4f9b47ed
45
config/urls.js
Normal file
45
config/urls.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* BACKEND URL CONFIGURATION - SINGLE SOURCE OF TRUTH
|
||||||
|
* To switch between environments, simply comment/uncomment the URLs below
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// LIVE PRODUCTION URLS (Currently Active)
|
||||||
|
// ========================================
|
||||||
|
const FRONTEND_URL = 'https://dashboard.codenuk.com';
|
||||||
|
const BACKEND_URL = 'https://backend.codenuk.com';
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// LOCAL DEVELOPMENT URLS (Comment out live URLs above and uncomment these)
|
||||||
|
// ========================================
|
||||||
|
// const FRONTEND_URL = 'http://localhost:3001';
|
||||||
|
// const BACKEND_URL = 'http://localhost:8000';
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// CORS CONFIGURATION (Auto-generated)
|
||||||
|
// ========================================
|
||||||
|
const CORS_CONFIG = {
|
||||||
|
ORIGIN: FRONTEND_URL,
|
||||||
|
METHODS: 'GET,POST,PUT,DELETE,PATCH,OPTIONS',
|
||||||
|
CREDENTIALS: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// EXPORTS
|
||||||
|
// ========================================
|
||||||
|
module.exports = {
|
||||||
|
FRONTEND_URL,
|
||||||
|
BACKEND_URL,
|
||||||
|
CORS_CONFIG,
|
||||||
|
|
||||||
|
// Helper functions
|
||||||
|
getApiUrl: (endpoint) => {
|
||||||
|
const cleanEndpoint = endpoint.startsWith('/') ? endpoint.slice(1) : endpoint;
|
||||||
|
return `${BACKEND_URL}/${cleanEndpoint}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Email verification URL helper
|
||||||
|
getVerificationUrl: (token) => {
|
||||||
|
return `${FRONTEND_URL}/verify-email?token=${encodeURIComponent(token)}`;
|
||||||
|
},
|
||||||
|
};
|
||||||
@ -233,7 +233,7 @@ services:
|
|||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
- PORT=8000
|
- PORT=8000
|
||||||
- HOST=0.0.0.0
|
- HOST=0.0.0.0
|
||||||
- FRONTEND_URL=http://localhost:3001 # Allow all URLs
|
- FRONTEND_URL=https://dashboard.codenuk.com # Allow all URLs
|
||||||
- CORS_ORIGINS=* # Allow all URLs
|
- CORS_ORIGINS=* # Allow all URLs
|
||||||
- CORS_METHODS=GET,POST,PUT,DELETE,PATCH,OPTIONS # Add this line
|
- CORS_METHODS=GET,POST,PUT,DELETE,PATCH,OPTIONS # Add this line
|
||||||
- CORS_CREDENTIALS=true # Add this line
|
- CORS_CREDENTIALS=true # Add this line
|
||||||
@ -507,7 +507,7 @@ services:
|
|||||||
- JWT_ACCESS_EXPIRY=24h
|
- JWT_ACCESS_EXPIRY=24h
|
||||||
- JWT_ADMIN_ACCESS_EXPIRY=7d
|
- JWT_ADMIN_ACCESS_EXPIRY=7d
|
||||||
- JWT_REFRESH_EXPIRY=7d
|
- JWT_REFRESH_EXPIRY=7d
|
||||||
- FRONTEND_URL=http://localhost:3001
|
- FRONTEND_URL=https://dashboard.codenuk.com
|
||||||
# Email Configuration
|
# Email Configuration
|
||||||
- SMTP_HOST=smtp.gmail.com
|
- SMTP_HOST=smtp.gmail.com
|
||||||
- SMTP_PORT=587
|
- SMTP_PORT=587
|
||||||
@ -613,7 +613,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- PORT=8012
|
- PORT=8012
|
||||||
- HOST=0.0.0.0
|
- HOST=0.0.0.0
|
||||||
- FRONTEND_URL=http://localhost:3001
|
- FRONTEND_URL=https://dashboard.codenuk.com
|
||||||
- POSTGRES_HOST=postgres
|
- POSTGRES_HOST=postgres
|
||||||
- POSTGRES_PORT=5432
|
- POSTGRES_PORT=5432
|
||||||
- POSTGRES_DB=dev_pipeline
|
- POSTGRES_DB=dev_pipeline
|
||||||
|
|||||||
@ -31,6 +31,6 @@ RABBITMQ_PASSWORD=secure_rabbitmq_password
|
|||||||
FRONTEND_URL=https://dashboard.codenuk.com
|
FRONTEND_URL=https://dashboard.codenuk.com
|
||||||
|
|
||||||
# CORS Configuration
|
# CORS Configuration
|
||||||
CORS_ORIGIN=http://localhost:3001
|
CORS_ORIGIN=https://dashboard.codenuk.com
|
||||||
CORS_METHODS=GET,POST,PUT,DELETE,PATCH,OPTIONS
|
CORS_METHODS=GET,POST,PUT,DELETE,PATCH,OPTIONS
|
||||||
CORS_CREDENTIALS=true
|
CORS_CREDENTIALS=true
|
||||||
@ -149,8 +149,8 @@ class AuthService {
|
|||||||
async sendVerificationEmail(user) {
|
async sendVerificationEmail(user) {
|
||||||
const token = await this.createEmailVerificationToken(user.id);
|
const token = await this.createEmailVerificationToken(user.id);
|
||||||
// Send users to the frontend verification page; the frontend will call the backend and handle redirects
|
// Send users to the frontend verification page; the frontend will call the backend and handle redirects
|
||||||
const frontendUrl = process.env.FRONTEND_URL || 'http://localhost:3001';
|
const { getVerificationUrl } = require('../../../../config/urls');
|
||||||
const verifyUrl = `${frontendUrl}/verify-email?token=${encodeURIComponent(token)}`;
|
const verifyUrl = getVerificationUrl(token);
|
||||||
|
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const dateString = today.toLocaleDateString('en-US');
|
const dateString = today.toLocaleDateString('en-US');
|
||||||
|
|||||||
@ -28,7 +28,8 @@ export default function BusinessQuestionsScreen() {
|
|||||||
console.log('🚀 Generating comprehensive business questions for integrated system:', selectedFeatures);
|
console.log('🚀 Generating comprehensive business questions for integrated system:', selectedFeatures);
|
||||||
|
|
||||||
// Call the new comprehensive endpoint
|
// Call the new comprehensive endpoint
|
||||||
const response = await fetch('http://localhost:8000/api/v1/generate-comprehensive-business-questions', {
|
const { getApiUrl } = require('../../../../../../config/urls');
|
||||||
|
const response = await fetch(getApiUrl('api/v1/generate-comprehensive-business-questions'), {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user