title: How to resolve graphql field parameters using javascript
body: <p>I make resolver for this query (with parameter)</p>
  <p><a href="https://i.stack.imgur.com/cxoq7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cxoq7.png" alt="enter image description here" /></a></p>
  <p>but how to update my resolver to handle the &quot;mailtype&quot; parameter if it moved to the email field (for example), I need to run the commented query instead of the first one
  in general, I can't resolve the query field parameters (regardless of using variables)
  I try to use the parent default parameter to handle them but it didn't success
  here is my code (code description in image below)</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const express = require('express');
  const { ApolloServer, gql} = require('apollo-server-express');
  async function startApolloServer() {
    //array of user objects
    let users =
    [
      {
        "id":1,
        "name":"Magdalena",
        "email":"mgrewes0@gmail.com",
      },
      {
        "id":2,
        "name":"Lyndell",
        "email":"lgilbee1@yahoo.com",
      },
      {
        "id":3,
        "name":"Harman",
        "email":"hgaspero2@gmail.com",
      },
      {
        "id":4,
        "name":"ali",
        "email":"ali@yahoo.com",
      }
    ];
    const typeDefs = gql`
      type User {
          id: ID
          name: String
          email(mailtype: MailType): String
      }
      enum MailType{
          GMAIL
          YAHOO
      }
      type Query {
          getUserByEmailType(mailtype: MailType): [User]
      }
    `;
    const resolvers = {
      MailType: {
          GMAIL: "gmail",
          YAHOO: "yahoo"
      },
      Query: {
          getUserByEmailType: (parent, args) =&gt; users.filter(user =&gt; user.email.indexOf(args.mailtype) &gt;= 0 ),
      },
    };
    const server = new ApolloServer({
      typeDefs,
      resolvers,
    });
    await server.start();
    const app = express();
    server.applyMiddleware({ app});
    await new Promise(resolve =&gt; app.listen({ port: 7000 }, resolve));
    console.log(` Server ready at http://localhost:7000${server.graphqlPath}`);
    return { server, app };
  }
  startApolloServer()</code></pre>
  </div>
  </div>
  </p>
  <p><a href="https://i.stack.imgur.com/yO4GG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yO4GG.png" alt="enter image description here" /></a></p>