In the Apollo docs it shows this example:
const { ApolloServer, gql } = require('apollo-server');
const typeDefs = gql`
type Query {
hello: String
resolved: String
}
`;
const resolvers = {
Query: {
resolved: () => 'Resolved',
},
};
const mocks = {
Int: () => 6,
Float: () => 22.1,
String: () => 'Hello',
};
const server = new ApolloServer({
typeDefs,
resolvers,
mocks,
});
server.listen().then(({ url }) => {
console.log(` Server ready at ${url}`)
});
I want to be able to pass in an argument, such as an ID into it, like:
const mocks = {
Job: (id) => {
return somearray.filter(_id === id)
},
};
Is this possible with Apollo?