How to use the graphql-upload.graphqlUploadKoa function in graphql-upload

To help you get started, we’ve selected a few graphql-upload examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtex / node-vtex-api / src / service / worker / runtime / graphql / middlewares / upload.ts View on Github external
import { graphqlUploadKoa } from 'graphql-upload'

import { GraphQLServiceContext } from '../typings'

const graphqlUpload = graphqlUploadKoa({
  maxFieldSize: 1e6, // size in Bytes
  maxFileSize: 4 * 1e6, // size in Bytes
  maxFiles: 10,
})

function graphqlUploadKoaMiddleware(
  ctx: GraphQLServiceContext,
  next: () => Promise<void>
): Promise<void> {
  return graphqlUpload(ctx as any, next)
}

export const upload = graphqlUploadKoaMiddleware
github vtex / node-vtex-api / src / service / graphql / middlewares / upload.ts View on Github external
import { graphqlUploadKoa } from 'graphql-upload'
import { GraphQLServiceContext } from '../typings'

declare module 'graphql-upload' {
  export function graphqlUploadKoa(options: ApolloUploadOptions): (ctx: GraphQLServiceContext, next: () => Promise<any>) => Promise<void>
}

export const upload = graphqlUploadKoa({
  maxFieldSize: 1e6, // size in Bytes
  maxFileSize: 4 * 1e6,  // size in Bytes
  maxFiles: 5,
})