Skip to content

jangerhofer/apolloFileUpload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apollo File Upload Example

A little demo of how Apollo Server can handle file uploads.

This demo uses Meteor, Apollo Client+Server and Multer to show one way to handle file uploads to an Apollo app. It is adapted from the tests written for Express-GraphQL.

Usage

  • After installing the dependencies, run meteor to get up and running.
  • Post to localhost:3000/graphql with something along the lines of these post body key/value pairs:
    • query : mutation newFile($fileName : String) { uploadFile(fileSaveName : $fileName) { originalname, mimetype}}
    • operationName : newFile
    • variables : {"fileName": "SaveNameForNewFile"}
    • file : Attach a file to be uploaded. This is most easily done using a "REST Client" like Postman.
  • In the future, the file upload field currently in the UI should hook into Apollo Client and perform the upload. At the moment, that file uploader is pretty useless.

Example Postman request.

An example request.