-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#23 Migrated GraphQL endpoint configuration to `apollo-server-integra…
…tion-next` (#24) * Migrated to apollo-server-integration-next * Removed microCors module * Removed .DS_Store
- Loading branch information
Showing
8 changed files
with
1,493 additions
and
915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ node_modules/ | |
generated/ | ||
.swc/ | ||
.vercel | ||
|
||
.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,10 @@ | ||
import { RequestHandler } from 'micro'; | ||
import { startServerAndCreateNextHandler } from '@as-integrations/next'; | ||
import { createContextHandler } from 'server/lib/context'; | ||
|
||
import { createServer } from '../../server/lib/apollo'; | ||
import { cors } from '../../server/lib/micro'; | ||
import { prisma } from '../../server/prisma'; | ||
|
||
const apolloServer = createServer(); | ||
const startServer = apolloServer.start(); | ||
|
||
export const handler: RequestHandler = async (req, res) => { | ||
if (req.method === 'OPTIONS') { | ||
res.end(); | ||
return; | ||
} | ||
|
||
await startServer; | ||
await prisma.$connect(); | ||
|
||
await apolloServer.createHandler({ path: '/api/graphql' })(req, res); | ||
}; | ||
|
||
export const config = { | ||
api: { | ||
bodyParser: false, | ||
}, | ||
}; | ||
|
||
export default cors(handler); | ||
export default startServerAndCreateNextHandler(apolloServer, { | ||
context: createContextHandler, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65bb3ed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
apollo-blog – ./
apollo-blog-zaxoavoki.vercel.app
apollo-blog.vercel.app
apollo-blog-git-dev-zaxoavoki.vercel.app