adonis-gql icon indicating copy to clipboard operation
adonis-gql copied to clipboard

Scope of works

Open HigoRibeiro opened this issue 5 years ago • 3 comments

Provider basic

  • [x] Provider base
  • [x] Read schema
  • [x] Read Resolver
  • [x] Tests
  • [x] Commands

Provider Advanced

  • [x] Directive support
  • [x] Accept middleware
  • [ ] Subscription System

HigoRibeiro avatar Mar 08 '19 22:03 HigoRibeiro

Resolvers and schemas will be structured following the structure that AdonisJS adopts in its controllers, respecting its particularities.

Defining the things

Inside start/graphql.js you declare the schemas and resolvers.

You can call a callback in the schema to define the resolvers that are pertinent to it, so it's optional. In the same way you can define a resolver independent of a schema, but in this case you must pass the name and the controller of the same one.

const Gql = use('Gql')

Gql.schema('Post', () => {
  Gql.query('Query/PostController')
  Gql.mutation('Mutation/PostController')
})

Gql.schema('User')
Gql.mutation('User', 'Mutation/UserController')

Inside start/gqlKernel.js you register the things described above. Future will be the global middlewares and named middlewares.

const Gql = use('Gql')
Gql.register()

The controllers are in the app/Controllers/Gql directory.

HigoRibeiro avatar Mar 15 '19 00:03 HigoRibeiro

On the commands I think of following the style adopted by migrations, where we will have the term graphql preceded by what we want.

Exemples

Make only the schema Post:

adonis gql:schema Post

Make the schema Post with the controllers for query and mutation:

adonis gql:schema Post -r

HigoRibeiro avatar Mar 15 '19 23:03 HigoRibeiro

hello @HigoRibeiro , i think you must move this issue as an example and provide more examples and documentations at least an example of "Hello world"

annymosse avatar Jul 24 '19 05:07 annymosse