Express-graphql: Uploading file using graphql

Created on 28 May 2018  路  4Comments  路  Source: graphql/express-graphql

How can i upload file using angular 5 + Apollo client using apollo express and Node

question

Most helpful comment

Example from the graphql-upload docs:

const express = require('express');
const graphqlHTTP = require('express-graphql');
const { graphqlUploadExpress } = require('graphql-upload');
const schema = require('./schema');

express()
  .use(
    '/graphql',
    graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }),
    graphqlHTTP({ schema })
  )
  .listen(3000);

All 4 comments

I can`t find reliable example with apolllo-upload-client and express-graphql

using apollo express

This is the repo for express-graphql, a different GraphQL server to Apollo Server for Express.

Regardless, you will be interested in checking out graphql-upload - it supports both of these GraphQL servers and more.

@ChampTiravat is right, if you are using Apollo Client you can use apollo-upload-client.

Example from the graphql-upload docs:

const express = require('express');
const graphqlHTTP = require('express-graphql');
const { graphqlUploadExpress } = require('graphql-upload');
const schema = require('./schema');

express()
  .use(
    '/graphql',
    graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }),
    graphqlHTTP({ schema })
  )
  .listen(3000);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

phuchle2 picture phuchle2  路  3Comments

m-diiorio picture m-diiorio  路  4Comments

naivefun picture naivefun  路  3Comments

PavanBahuguni picture PavanBahuguni  路  3Comments

jamesmoriarty picture jamesmoriarty  路  4Comments