-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
323 additions
and
541 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
Binary file not shown.
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,32 +1,30 @@ | ||
import { ApolloServer } from "apollo-server-micro"; | ||
import { buildFederatedSchema } from "@apollo/federation"; | ||
import { ApolloServerPluginInlineTraceDisabled } from "apollo-server-core"; | ||
import { typeDefs, resolvers } from "./merge-packages"; | ||
import { dataSources } from "./data-sources/"; | ||
import cors from "micro-cors"; | ||
import { buildSubgraphSchema } from "@apollo/subgraph"; | ||
const corsHandler = cors({ | ||
allowMethods: ["OPTIONS", "POST", "GET"], | ||
allowHeaders: ["*"], | ||
}); | ||
|
||
const apolloServer = new ApolloServer({ | ||
schema: buildFederatedSchema({ typeDefs, resolvers }), | ||
dataSources, | ||
playground: true, | ||
introspection: true, | ||
cacheControl: { | ||
defaultMaxAge: 300, | ||
}, | ||
plugins: [ApolloServerPluginInlineTraceDisabled()], | ||
}); | ||
|
||
export const config = { | ||
api: { | ||
bodyParser: false, | ||
}, | ||
}; | ||
|
||
const handler = apolloServer.createHandler({ path: "/api/graphql" }); | ||
export default corsHandler((req, res) => | ||
req.method === "OPTIONS" ? res.end() : handler(req, res) | ||
); | ||
export default corsHandler(async (req, res) => { | ||
const apolloServer = new ApolloServer({ | ||
schema: buildSubgraphSchema({ typeDefs, resolvers }), | ||
dataSources, | ||
apollo: { | ||
graphId: "spaceapi", | ||
graphVariant: "main", | ||
}, | ||
}); | ||
await apolloServer.start(); | ||
const handler = apolloServer.createHandler({ path: "/api/graphql" }); | ||
|
||
req.method === "OPTIONS" ? res.end() : handler(req, res); | ||
}); |
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 |
---|---|---|
|
@@ -76,4 +76,4 @@ type Query { | |
missions: [Mission] | ||
} | ||
|
||
scalar _FieldSet | ||
scalar _FieldSet |
Oops, something went wrong.
10f9618
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:
spaceapi-missions-graphql – ./
spaceapi-missions-graphql-git-main-scottjungling.vercel.app
space-api-graphql.vercel.app
spaceapi-missions-graphql-scottjungling.vercel.app
mission-service.spaceapi.dev