46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
/**
|
|
* BACKEND URL CONFIGURATION - SINGLE SOURCE OF TRUTH
|
|
* To switch between environments, simply comment/uncomment the URLs below
|
|
*/
|
|
|
|
// ========================================
|
|
// LIVE PRODUCTION URLS
|
|
// ========================================
|
|
// const FRONTEND_URL = 'https://dashboard.codenuk.com';
|
|
// const BACKEND_URL = 'https://backend.codenuk.com';
|
|
|
|
// ========================================
|
|
// LOCAL DEVELOPMENT URLS (Currently Active)
|
|
// ========================================
|
|
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)}`;
|
|
},
|
|
};
|