@kunalsin9h/load-gql
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

load-gql

A tiny GraphQL schema loader

Usage

Add dependency

npm i @kunalsin9h/load-gql

Usage

import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import loadGraphQL from "@kunalsin9h/load-gql";
import resolvers from "./resolvers";

// assuming graphql-schemas is a folder where all the schema files reside
const typeDefs = loadGraphQL("graphql-schemas", "temp.gql");

const server = new ApolloServer({
  typeDefs,
  resolvers,
});

const { url } = await startStandaloneServer(server, {
  listen: {
    port: 3033,
  },
});

console.log(`Started server at ${url}`);

Readme

Keywords

Package Sidebar

Install

npm i @kunalsin9h/load-gql

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

4.03 kB

Total Files

5

Last publish

Collaborators

  • kunalsin9h