How to use the graphql-config.loadConfig function in graphql-config

To help you get started, we’ve selected a few graphql-config 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 / generator-fullstack / server / src / index.ts View on Github external
async function start() {
  const app = express();

  app.use(cors());

  app.get('/health', (req, res) => res.sendStatus(200));

  const config = await loadConfig({
    extensions: [() => ({ name: 'generate' })]
  });

  const generateConfig = await config!.getDefault().extension('generate');

  // connect to db
  const db = await connect(generateConfig.db.dbConfig);

  const schema = makeExecutableSchema({
    typeDefs,
    resolvers,
    resolverValidationOptions: {
      requireResolversForResolveType: false
    }
  });
github dotansimha / graphql-code-generator / packages / graphql-codegen-cli / src / graphql-config.ts View on Github external
export async function findAndLoadGraphQLConfig(filepath?: string): Promise {
  const config = await loadConfig({
    filepath,
    rootDir: process.cwd(),
    extensions: [CodegenExtension],
    throwOnEmpty: false,
    throwOnMissing: false,
  });

  if (isGraphQLConfig(config)) {
    return config;
  }
}
github aerogear / graphback / examples / generator-fullstack / server / src / db.ts View on Github external
export async function connect(options: knex.MySqlConnectionConfig) {
  const config = await loadConfig({
    extensions: [() => ({ name: 'generate'})]
  });
  const { db } = await config!.getDefault().extension('generate');
  return knex({
    client: db.database,
    connection: options
  })
}