$ npm install @graphback/runtime
Auto generate database structure,
GraphQL Resolvers and Queries from GraphQL types 🚀
Documentation: https://graphback.dev Repository: https://github.com/aerogear/graphback/
Autogenerated runtime layer for your schema. Graphback runtime can provide out of the box resolver and database layer for your application without writing any line of the code.
To use runtime capabilities developers will need to create data provider. Currently 2 data providers are supported:
Default data providers utilize knex.js library as it supports wider range of the databases out of the box and provides great developer experience.
Then developers can create runtime instance:
import { SchemaGenerator, gqlSchemaFormatter } from "@graphback/codegen-schema"
import { graphQLInputContext } from "@graphback/core"
const inputContext = graphQLInputContext.createModelContext(schemaText, {})
const schemaGenerator = new SchemaGenerator(inputContext, gqlSchemaFormatter)
const schema = schemaGenerator.generate()
const client = new Knex(...);
const graphbackOptions = {...}
const modelString = `type Test ...`
const defaultProvider = new CRUDService(client);
const resolverGenerator = new LayeredRuntimeResolverGenerator(inputContext, defaultProvider)
const dbClientProvider = new PgKnexDBDataProvider(client);
const resolvers = resolverGenerator.generate();
console.log(schema, resolvers)
Check our example application: https://github.com/aerogear/graphback/tree/master/examples/runtime-example
@graphback/codegen-resolvers package generates a resolver layer that utilizes the CRUD layer generated by the runtime framework.
By default resolver layer will based on the crudService field attached to context.
Developers can use the helper function createKnexRuntimeContext that will build default context for resolver layer.
See example app: https://github.com/aerogear/graphback/tree/master/examples/generator-fullstack
docker-compose up -d
graphback db
npm start
Enjoy runtime app
© 2010 - cnpmjs.org x YWFE | Home | YWFE