How to use the graphback.PgKnexDBDataProvider function in graphback

To help you get started, we’ve selected a few graphback examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aerogear / graphback / examples / runtime-example / src / runtime.ts View on Github external
export const createRuntime = async (client: Knex) => {
  const schemaText = loadSchema(jsonConfig.folders.model);

  const backend = new GraphQLBackendCreator(schemaText, jsonConfig.graphqlCRUD);
  const dbClientProvider = new PgKnexDBDataProvider(client);

  const dbConfig = {
    client: jsonConfig.db.database,
    connection: jsonConfig.db.dbConfig
  };

  migrateDB(dbConfig, schemaText).then((ops) => {
    console.log(ops);
  });

  const pubSub = new PubSub();
  const runtime = await backend.createRuntime(dbClientProvider, pubSub);
  const generatedSchema = runtime.schema;

  const executableSchema = makeExecutableSchema({
    typeDefs: gql`${generatedSchema}`,
github aerogear / graphback / examples / runtime-example / src / runtime.ts View on Github external
export const createRuntime = async (client: Knex) => {
  const schemaText = loadSchema(jsonConfig.folders.model);

  const backend = new GraphQLBackendCreator(schemaText, jsonConfig.graphqlCRUD);
  const dbClientProvider = new PgKnexDBDataProvider(client);

  const dbConfig = {
    client: jsonConfig.db.database,
    connection: jsonConfig.db.dbConfig
  };

  migrate(dbConfig, schemaText, {
    dbSchemaName: jsonConfig.db.schema
  }).then((ops) => {
    console.log(ops);
  });

  const pubSub = new PubSub();
  const runtime = await backend.createRuntime(dbClientProvider, pubSub);
  const generatedSchema = runtime.schema;
github aerogear / graphback / templates / apollo-starter-ts / src / runtime.ts View on Github external
export const createRuntime = async (client: Knex, pubSub: PubSub) => {
    const runtimeSchema = readFileSync(resolve(__dirname, "./runtime.graphql"), 'utf8');
    const backend = new GraphQLBackendCreator(runtimeSchema, jsonConfig.graphqlCRUD);
    const dbClientProvider = new PgKnexDBDataProvider(client);
    const runtime = await backend.createRuntime(dbClientProvider, pubSub);
    const generatedSchema = runtime.schema;
    const executableSchema = makeExecutableSchema({
        typeDefs: gql`${generatedSchema}`,
        resolvers: runtime.resolvers,
        resolverValidationOptions: {
            requireResolversForResolveType: false
        }
    });
    return executableSchema;
}