Skip to content

Instantly share code, notes, and snippets.

@epalaz
Last active September 12, 2020 10:19
Show Gist options
  • Save epalaz/c0d7474b7085ecfc1827a2e963278cd5 to your computer and use it in GitHub Desktop.
Save epalaz/c0d7474b7085ecfc1827a2e963278cd5 to your computer and use it in GitHub Desktop.
Type Definitions for File Upload Mutations
const typeDefs = gql`
type File {
filename: String!
mimetype: String!
encoding: String!
}
type Query {
_ : Boolean // Added here to satisfy requirement of having at least one query defined
}
type Mutation {
singleUpload(file: Upload!): File!,
singleUploadStream(file: Upload!): File!
}
`;
@izaa
Copy link

izaa commented Sep 12, 2020

Error: Unknown type "Upload". Did you mean "Float"?
please

import { GraphQLUpload } from 'graphql-upload';

const { makeExecutableSchema } = require('graphql-tools');
const { GraphQLUpload } = require('graphql-upload');

const schema = makeExecutableSchema({
  typeDefs: /* GraphQL */ `
    scalar Upload
  `,
  resolvers: {
    Upload: GraphQLUpload,
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment