123
This commit is contained in:
10
.env.example
10
.env.example
@ -6,7 +6,7 @@
|
|||||||
# - NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY — один и тот же проект Supabase
|
# - NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY — один и тот же проект Supabase
|
||||||
# - SUPABASE_SERVICE_ROLE_KEY — из того же проекта (Settings → API → service_role secret)
|
# - SUPABASE_SERVICE_ROLE_KEY — из того же проекта (Settings → API → service_role secret)
|
||||||
# - JWT_SECRET — любая длинная строка (для подписи JWT на бэкенде)
|
# - JWT_SECRET — любая длинная строка (для подписи JWT на бэкенде)
|
||||||
# - NEXT_PUBLIC_API_URL — URL бэкенда (для фронта; если не задан, по умолчанию localhost:3001)
|
# - NEXT_PUBLIC_API_URL — URL бэкенда (для фронта; если не задан, по умолчанию localhost:3125)
|
||||||
#
|
#
|
||||||
# ===========================================
|
# ===========================================
|
||||||
|
|
||||||
@ -53,10 +53,10 @@ S3_SECRET_ACCESS_KEY="your-secret-key"
|
|||||||
S3_BUCKET_NAME="coursecraft"
|
S3_BUCKET_NAME="coursecraft"
|
||||||
S3_REGION="auto"
|
S3_REGION="auto"
|
||||||
|
|
||||||
# App URLs
|
# App URLs (API на 3125; веб — свой порт, напр. 3000)
|
||||||
NEXT_PUBLIC_APP_URL="http://localhost:3125"
|
NEXT_PUBLIC_APP_URL="http://localhost:3000"
|
||||||
NEXT_PUBLIC_API_URL="http://localhost:3001"
|
NEXT_PUBLIC_API_URL="http://localhost:3125"
|
||||||
API_URL="http://localhost:3001"
|
API_URL="http://localhost:3125"
|
||||||
AI_SERVICE_URL="http://localhost:3002"
|
AI_SERVICE_URL="http://localhost:3002"
|
||||||
|
|
||||||
# JWT Secret — ОБЯЗАТЕЛЕН для API (подпись токенов после обмена с Supabase)
|
# JWT Secret — ОБЯЗАТЕЛЕН для API (подпись токенов после обмена с Supabase)
|
||||||
|
|||||||
@ -12,14 +12,14 @@ async function bootstrap() {
|
|||||||
// Security
|
// Security
|
||||||
app.use(helmet());
|
app.use(helmet());
|
||||||
|
|
||||||
// CORS (веб на порту 3125)
|
// CORS (веб часто на 3000)
|
||||||
const allowedOrigins = [
|
const allowedOrigins = [
|
||||||
configService.get('NEXT_PUBLIC_APP_URL'),
|
configService.get('NEXT_PUBLIC_APP_URL'),
|
||||||
'http://localhost:3125',
|
|
||||||
'http://localhost:3000',
|
'http://localhost:3000',
|
||||||
|
'http://localhost:3125',
|
||||||
].filter(Boolean) as string[];
|
].filter(Boolean) as string[];
|
||||||
app.enableCors({
|
app.enableCors({
|
||||||
origin: allowedOrigins.length ? allowedOrigins : 'http://localhost:3125',
|
origin: allowedOrigins.length ? allowedOrigins : 'http://localhost:3000',
|
||||||
credentials: true,
|
credentials: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ async function bootstrap() {
|
|||||||
SwaggerModule.setup('docs', app, document);
|
SwaggerModule.setup('docs', app, document);
|
||||||
}
|
}
|
||||||
|
|
||||||
const port = configService.get('PORT') || 3001;
|
const port = configService.get('PORT') || 3125;
|
||||||
await app.listen(port);
|
await app.listen(port);
|
||||||
|
|
||||||
console.log(`🚀 API is running on: http://localhost:${port}/api`);
|
console.log(`🚀 API is running on: http://localhost:${port}/api`);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
|
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3125';
|
||||||
const API_URL = `${API_BASE}/api`;
|
const API_URL = `${API_BASE}/api`;
|
||||||
|
|
||||||
const STORAGE_KEY = 'coursecraft_api_token';
|
const STORAGE_KEY = 'coursecraft_api_token';
|
||||||
|
|||||||
Reference in New Issue
Block a user