Skip to content

Commit

Permalink
fix: cors issue
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 committed Feb 14, 2024
1 parent ad717c4 commit 7ec1111
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions api/src/graphql/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { ApolloServerPlugin, ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4';
import bodyParser from 'body-parser';
import cookierParser from 'cookie-parser';
import cors from 'cors';
import { PORT } from '../../env';
import { schemaWithMiddleware as indexSchema } from './index/schema';
import { schemaWithMiddleware as driveSchema } from './drive/schema';
import { Context as IndexContext, createContext as createIndexContext } from './index/context';
Expand Down Expand Up @@ -52,6 +54,7 @@ export const startServer = async (

app.use(
'/drives',
cors<cors.CorsRequest>(),
cookierParser(undefined, { decode: (value: string) => value }),
bodyParser.json(),
expressMiddleware(apolloIndex, {
Expand All @@ -61,6 +64,7 @@ export const startServer = async (

app.use(
'/d/:driveId',
cors<cors.CorsRequest>(),
cookierParser(undefined, { decode: (value: string) => value }),
bodyParser.json(),
expressMiddleware(apolloDrive, {
Expand Down
10 changes: 5 additions & 5 deletions api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1972,10 +1972,10 @@ doctrine@^3.0.0:
dependencies:
esutils "^2.0.2"

[email protected].28:
version "0.0.28"
resolved "https://registry.yarnpkg.com/document-drive/-/document-drive-0.0.28.tgz#cc29c23bfe3d39f47d277387d0b7b1b0f31a463a"
integrity sha512-qc+ekjMwnNuvCfxP0RUPVI1qItilYFeCD0KiKYB6yFY020+LLPuWqEPFVd8W03EPi4fXptNWzW0N1Pi0oVK3hA==
document-drive@^0.0.29:
version "0.0.29"
resolved "https://registry.yarnpkg.com/document-drive/-/document-drive-0.0.29.tgz#ab00d60bbcf34f0b1c1d75cbecb172cc3d92994a"
integrity sha512-p1kss+TZpVoNgPeys13+sI3nOE030KxdqmmFgEH5UGzYYMQypCQvfsVmI8M5Sgokws84gBVAHX6QFRZaNQ2Sjg==
dependencies:
graphql "^16.8.1"
graphql-request "^6.1.0"
Expand All @@ -1987,7 +1987,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/document-model-libs/-/document-model-libs-1.1.43.tgz#d12704c9faa700c27de38d6d47d577420d446676"
integrity sha512-bDZTeBc0XVFP1hQ1sfcRVPGMrMS8tnLTsumLyGg7VeBf/yGJBAqRrEl5NSMmWBr9lVkdUKCVpHHFCIadB8NjBQ==

[email protected]:
document-model@^1.0.29:
version "1.0.29"
resolved "https://registry.yarnpkg.com/document-model/-/document-model-1.0.29.tgz#befdca50981511011d0fb194bbe0c313dd87cb88"
integrity sha512-CX3d3+aD6tbRD7y666k9UNMEGFKPTew44dgN5CBixEToAcOel3Ai9un24fiOFtiLCUYpJ8LAsxVOCWBeP+Jq5g==
Expand Down

0 comments on commit 7ec1111

Please sign in to comment.