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
): Promise {
  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) => Promise
}

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

graphql-upload

Middleware and a scalar Upload to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.

MIT
Latest version published 1 month ago

Package Health Score

77 / 100
Full package analysis