0.3.3 • Published 4 years ago

adonis-graphql-upload v0.3.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Adonis GraphQL Upload:

Adonis GraphQL Upload can be used with adonis-graphql for file uploads.

Setup

The package must be installed by using adonis command.

> adonis install adonis-graphql-upload

You can use directly npm or yarn but the instructions (instructions.js and instructions.md) will not be displayed and ran.

:warning: This package requires @adonisjs/bodyparser and graphql to be installed.

Register provider

Start by registering the provider inside start/app.js file.

const providers = ['adonis-graphql-upload/providers/GraphQLUploadProvider'];

Register middleware

The next thing is to register the middleware.

The middleware is registered inside start/kernel.js file.

const namedMiddleware = {
  graphqlUpload: 'Adonis/Middleware/GraphQLUpload',
};

Then you can use the middleware in any route you want.

Route.get().middleware('graphqlUpload');

Create Scalar Type for GraphQL Schema

Run the following command

adonis make:guploadscalar

Now you can use 'File' type for file upload, like following:

type Mutation {
  uploadFile(file: File!): UploadFileResponse
}
0.3.0

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.3

4 years ago

0.2.0

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago