express-graphql icon indicating copy to clipboard operation
express-graphql copied to clipboard

Uploading file using graphql

Open macin40 opened this issue 8 years ago • 4 comments

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

macin40 avatar May 28 '18 13:05 macin40

you can use this lib https://github.com/jaydenseric/apollo-upload-client

ChampTiravat avatar Aug 07 '18 03:08 ChampTiravat

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

eedfa avatar Sep 20 '18 09:09 eedfa

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.

jaydenseric avatar Nov 01 '18 02:11 jaydenseric

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);

danielrearden avatar Jun 01 '20 01:06 danielrearden