Skip to content

Instantly share code, notes, and snippets.

@pekkis
Last active March 13, 2018 12:56
Show Gist options
  • Save pekkis/904fb6d5170029b4307879064ab3de89 to your computer and use it in GitHub Desktop.
Save pekkis/904fb6d5170029b4307879064ab3de89 to your computer and use it in GitHub Desktop.
import schema from "./schema";
import { graphqlExpress, graphiqlExpress } from "apollo-server-express";
app.use(
"/graphql",
graphqlExpress(req => {
return {
schema
};
})
);
app.use(
"/graphiql",
graphiqlExpress({
endpointURL: "/graphql"
})
);
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