update cors
This commit is contained in:
@@ -14,7 +14,7 @@ services:
|
|||||||
- DATABASE_URL=postgresql://your_username:your_password@10.0.27.1:5432/epess
|
- DATABASE_URL=postgresql://your_username:your_password@10.0.27.1:5432/epess
|
||||||
- CLERK_PUBLISHABLE_KEY=pk_test_aW4tY2hpbXAtOTcuY2xlcmsuYWNjb3VudHMuZGV2JA
|
- CLERK_PUBLISHABLE_KEY=pk_test_aW4tY2hpbXAtOTcuY2xlcmsuYWNjb3VudHMuZGV2JA
|
||||||
- CLERK_SECRET_KEY=sk_test_sA5lsb1GHwUNXWQCp5ev70QkaoF5EmdAHNWiCGwZF6
|
- CLERK_SECRET_KEY=sk_test_sA5lsb1GHwUNXWQCp5ev70QkaoF5EmdAHNWiCGwZF6
|
||||||
- CORS_ORIGIN=http://localhost:3000
|
- CORS_ORIGIN=https://epess.org,https://admin.epess.org,https://center.epess.org,http://localhost:3000,http://localhost:3069,http://localhost:3001
|
||||||
- LISTEN_PORT=3069
|
- LISTEN_PORT=3069
|
||||||
- SWAGGER_PATH=/v1
|
- SWAGGER_PATH=/v1
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
17
package-lock.json
generated
17
package-lock.json
generated
@@ -10,7 +10,7 @@
|
|||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/server": "^4.11.0",
|
"@apollo/server": "^4.11.0",
|
||||||
"@clerk/clerk-sdk-node": "^5.0.45",
|
"@clerk/express": "^1.2.2",
|
||||||
"@graphql-codegen/cli": "^5.0.2",
|
"@graphql-codegen/cli": "^5.0.2",
|
||||||
"@graphql-codegen/introspection": "^4.0.3",
|
"@graphql-codegen/introspection": "^4.0.3",
|
||||||
"@graphql-codegen/typescript": "^4.0.9",
|
"@graphql-codegen/typescript": "^4.0.9",
|
||||||
@@ -1827,19 +1827,22 @@
|
|||||||
"node": ">=18.17.0"
|
"node": ">=18.17.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@clerk/clerk-sdk-node": {
|
"node_modules/@clerk/express": {
|
||||||
"version": "5.0.49",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@clerk/clerk-sdk-node/-/clerk-sdk-node-5.0.49.tgz",
|
"resolved": "https://registry.npmjs.org/@clerk/express/-/express-1.2.2.tgz",
|
||||||
"integrity": "sha512-1MmXcqYIgifya6ISQw34Fv3E+xHaCvdD1d97efUJvytEvE6oMdQpP1sLyzkhfcb1RXk7T7y7OGZggQbirP3JXQ==",
|
"integrity": "sha512-rI+jKVDmp9KUSHW04ZVUsrG4oP652AgYczyFCF0r1/2bEgpxxtUmZt5W2M4xyBV4hn9a649ic2NlChcKFqve2A==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clerk/backend": "1.13.9",
|
"@clerk/backend": "^1.13.9",
|
||||||
"@clerk/shared": "2.9.0",
|
"@clerk/shared": "^2.9.0",
|
||||||
"@clerk/types": "4.25.0",
|
"@clerk/types": "4.25.0",
|
||||||
"tslib": "2.4.1"
|
"tslib": "2.4.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17.0"
|
"node": ">=18.17.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"express": "^4.17.0 || ^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@clerk/shared": {
|
"node_modules/@clerk/shared": {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/server": "^4.11.0",
|
"@apollo/server": "^4.11.0",
|
||||||
"@clerk/clerk-sdk-node": "^5.0.45",
|
"@clerk/express": "^1.2.2",
|
||||||
"@graphql-codegen/cli": "^5.0.2",
|
"@graphql-codegen/cli": "^5.0.2",
|
||||||
"@graphql-codegen/introspection": "^4.0.3",
|
"@graphql-codegen/introspection": "^4.0.3",
|
||||||
"@graphql-codegen/typescript": "^4.0.9",
|
"@graphql-codegen/typescript": "^4.0.9",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
Inject,
|
Inject,
|
||||||
UnauthorizedException,
|
UnauthorizedException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import Clerk from '@clerk/clerk-sdk-node';
|
import Clerk from '@clerk/express';
|
||||||
import { GqlExecutionContext } from '@nestjs/graphql';
|
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Module, Global } from '@nestjs/common';
|
import { Module, Global } from '@nestjs/common';
|
||||||
import Clerk from '@clerk/clerk-sdk-node';
|
import Clerk from '@clerk/express';
|
||||||
import { ClerkService } from './clerk.service';
|
import { ClerkService } from './clerk.service';
|
||||||
import ClerkController from './clerk.controller';
|
import ClerkController from './clerk.controller';
|
||||||
@Global()
|
@Global()
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import {
|
|||||||
} from '@smatch-corp/nestjs-pothos';
|
} from '@smatch-corp/nestjs-pothos';
|
||||||
import { Builder } from '../Graphql/graphql.builder';
|
import { Builder } from '../Graphql/graphql.builder';
|
||||||
import { PrismaService } from '../Prisma/prisma.service';
|
import { PrismaService } from '../Prisma/prisma.service';
|
||||||
import { clerkClient } from '@clerk/clerk-sdk-node';
|
import { clerkClient } from '@clerk/express';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserSchema extends PothosSchema {
|
export class UserSchema extends PothosSchema {
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
|||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
|
const corsOrigin = (process.env.CORS_ORIGIN ?? '').split(','); // split by comma to array
|
||||||
app.enableCors({
|
app.enableCors({
|
||||||
origin: process.env.CORS_ORIGIN,
|
origin: corsOrigin,
|
||||||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
|
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
|
||||||
allowedHeaders: ['Content-Type', 'Authorization'],
|
allowedHeaders: ['Content-Type', 'Authorization'],
|
||||||
credentials: true,
|
credentials: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user