Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
chore(backend): configure CORS for development and production environments (#4430)
Binayak Bhattacharjee9b0e1af92dcc
diff --git a/packages/hoppscotch-backend/src/main.ts b/packages/hoppscotch-backend/src/main.tsindex 313bbfff1..fb39809a0 100644--- a/packages/hoppscotch-backend/src/main.ts+++ b/packages/hoppscotch-backend/src/main.ts@@ -41,7 +41,7 @@ async function bootstrap() {const configService = app.get(ConfigService);- console.log(`Running in production: ${configService.get('PRODUCTION')}`);+ console.log(`Running in production: ${configService.get('PRODUCTION')}`);console.log(`Port: ${configService.get('PORT')}`);checkEnvironmentAuthProvider(@@ -62,21 +62,20 @@ async function bootstrap() {}),);- if (configService.get('PRODUCTION') === 'false') {- console.log('Enabling CORS with development settings');-+ if (configService.get('PRODUCTION') === 'true') {+ console.log('Enabling CORS with production settings');app.enableCors({origin: configService.get('WHITELISTED_ORIGINS').split(','),credentials: true,});} else {- console.log('Enabling CORS with production settings');-+ console.log('Enabling CORS with development settings');app.enableCors({- origin: configService.get('WHITELISTED_ORIGINS').split(','),+ origin: true,credentials: true,});}+app.enableVersioning({type: VersioningType.URI,});