Last active
March 13, 2018 12:56
-
-
Save pekkis/904fb6d5170029b4307879064ab3de89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import schema from "./schema"; | |
import { graphqlExpress, graphiqlExpress } from "apollo-server-express"; | |
app.use( | |
"/graphql", | |
graphqlExpress(req => { | |
return { | |
schema | |
}; | |
}) | |
); | |
app.use( | |
"/graphiql", | |
graphiqlExpress({ | |
endpointURL: "/graphql" | |
}) | |
); |
This file contains hidden or 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
import { makeExecutableSchema } from "graphql-tools"; | |
import tags from "./services/tag-service"; | |
import { getDisplayName } from "./utils/dictator"; | |
const typeDefs = ` | |
# the schema allows the following query: | |
type Query { | |
teams: [Team] | |
} | |
type Mutation { | |
} | |
# we need to tell the server which types represent the root query | |
# and root mutation types. We call them RootQuery and RootMutation by convention. | |
schema { | |
query: Query | |
mutation: Mutation | |
} | |
`; | |
const resolvers = { | |
Query: { | |
teams: () => {} | |
} | |
}; | |
const executableSchema = makeExecutableSchema({ | |
typeDefs, | |
resolvers | |
}); | |
export default executableSchema; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment