title: How to upload file with GraphQL and Apollo Upload Server in NodeJS?
body: <p>I did not get any proper example to upload a file via GraphQL, Apollo Server in NodeJS.</p>
  
  <p>I have written a mutation to send the message that is perfectly working. Here is the code sendMessage.js Mutation</p>
  
  <pre><code>const sendMessage = {
      type: ChatType,
      args: {
          input: {
              type: new GraphQLNonNull(new GraphQLInputObjectType({
                  name: 'ChatMessageInput',
                  fields: {
                      toUserId:{
                          name:'To User ID',
                          type: new GraphQLNonNull(GraphQLID)
                      },
                      message:{
                          name:'Message',
                          type: new GraphQLNonNull(GraphQLString)
                      }
                  }
              }))
          },
          file:{
              name: "File",
              type: uploadType
          }
      },
      async resolve(_, input, context) {
  
      }
      };
  
  module.exports = sendMessage;
  </code></pre>
  
  <p>Here the code I have written for creating the GraphQl End Point.</p>
  
  <pre><code>app.use('/api', bodyParser.json(), jwtCheck, 
  apolloUploadExpress({ uploadDir: "./uploads",maxFileSize: 10000000, maxFiles: 10 }),
  graphqlExpress(req =&gt; ({
    schema,
    context: {
      user: req.user,
      header:req.headers
    },
    formatError: error =&gt; ({
      status:error.message[0].status,
      message: error.message[0].message,
      state: error.message
    })
  })),function (err, req, res, next) {
    if (err.name === 'UnauthorizedError') { // Send the error rather than to show it on the console
      //console.log(err);
        res.status(401).send({errors:[err]});
    }
    else {
        next(err);
    }
  }
  );
  </code></pre>
  
  <p>Now, I want to add upload file functionality in the same mutation. Please help me how can I do that.</p>
  
  <p>Thanks in advance.</p>