1.0.4 • Published 5 years ago
structure-graphql v1.0.4
structure-graphql
Tool for structuring the GraphQL project.
Usage
- Define the convenient structure. For instance:
src/
|- graphql/
|- author/
| |- resolver.ts
| |- schema.graphql
|
|- book/
|- resolver.ts
|- schema.graphql
- Import all schemas and resolvers from the following folder.
const { typeDefs, resolvers } = getTypesAndResolvers({
folder: 'src/graphql'
})
- Use them for the schema.
import { makeExecutableSchema } from 'graphql-tools'
const schema = makeExecutableSchema({ typeDefs, resolvers })
Notes
- Schema extensions:
.graphql
,.gql
- Resolver extensions:
.js
,.ts
- Resolver filenames:
resolver
(default).- This is a custom option that can be set in the
resolversFilename
field. Also can be a glob (e.g.*resolver
).
- This is a custom option that can be set in the