Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename and more diverse examples #6

Closed
jaydenseric opened this issue Jun 25, 2018 · 5 comments
Closed

Rename and more diverse examples #6

jaydenseric opened this issue Jun 25, 2018 · 5 comments

Comments

@jaydenseric
Copy link
Owner

jaydenseric commented Jun 25, 2018

It's time to rethink the name and contents of this repo.

  • Apollo should be removed from the name, as uploads are not exclusive to Apollo Server and Client. A rename is also likely for apollo-upload-server: Package rename graphql-upload#68. It might make sense to rename the project graphql-mutipart-request-spec-examples (or something similar but shorter, like graphql-upload-examples).
  • Apollo Server now has apollo-upload-server built in, so we need to use something else like graphql-api-koa or express-graphql to demonstrate a manual setup.

A new project structure could include a variety of cross-compatible server and client examples, centering around the GraphQL multipart request spec.

  • Server:
    • apollo-upload-server
      • With graphql-api-koa
      • With express-graphql
    • apollo-server
  • Client:
    • apollo-upload-client
    • graphql-react

It would be great to have examples for each with common cloud storage providers such as AWS S3.

@fgcui1204
Copy link

looking forward to that. Thanks very much @jaydenseric

@dobbbri
Copy link

dobbbri commented Mar 12, 2019

I make this examples with Vue.js

Vue.js + Apollo + express
https://github.com/dobbbri/vue-apollo-express-upload

Vue.js + Apollo + koa
https://github.com/dobbbri/vue-apollo-server-koa-uplload

Vue.js + Apollo-server
https://github.com/dobbbri/vue-apollo-upload

@jaydenseric
Copy link
Owner Author

For now we'll keep this repo as just Apollo examples.

It would be a huge maintenance burden to somehow have examples for every framework multiplied by however many storage options; and I would not be able to quality control examples for frameworks and cloud services I don't have experience with.

I'm pretty happy with the code examples in the graphql-upload readme, and prefer not to duplicate such effort across multiple repos.

The GraphQL multipart request spec has become well adopted with over 20 client/server implementations. It’s now up to the individual frameworks and commercial offerings to advertise and document their support for GraphQL file uploads.

@thorizer
Copy link

thorizer commented Aug 3, 2020

@jaydenseric any chance I can find a full express-graphql example elsewhere ?

@jaydenseric
Copy link
Owner Author

jaydenseric commented Aug 3, 2020

@thorizer Not that I'm aware of, although someone probably has one somewhere. The setup is really easy though, and there are code examples in the graphql-upload readme:

https://github.com/jaydenseric/graphql-upload#function-graphqluploadexpress

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

Use GraphQLUpload in your schema, there are code examples in it's API documentation.

The way the file Upload scalar promises are handled in resolvers is exactly the same as the examples here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants