adonis-apollo
Apollo GraphQL server for AdonisJS 5.
Maintained by Zakodium
:warning: This module is unstable and in active development. Use at your own risk. |
---|
Prerequisites
This provider requires Adonis v5 and won't work with AdonisJS v4.
Installation
npm i adonis-apollo
node ace configure adonis-apollo
Then add the following to the "metaFiles"
array in .adonisrc.json
:
{
"pattern": "app/Schemas/*",
"reloadServer": true
}
Usage
Bind the apollo server to your AdonisJs application.
In start/routes.ts
:
import ApolloServer from '@ioc:Zakodium/Apollo/Server';
ApolloServer.applyMiddleware();
Route.group(() => {
ApolloServer.applyMiddleware();
}).middleware('someMiddleware');
Configuration
TODO
Scalars
All the resolvers from graphql-scalars
are installed automatically.
To enable any of the scalar types documented in graphql-scalars
,
for example DateTime
, just add a scalar line to your schema:
scalar DateTime
Uploads
To enable support for GraphQL uploads:
- Update the config of the bodyparser in
config/bodyparser.ts
by adding your GraphQL route (by default: /graphql
) to the multipart.processManually
array. - Add the Upload scalar to your schema:
scalar Upload
.
License
MIT