Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KunalSin9h/load-gql
A tiny GraphQL schema loader, zero dependencies.
https://github.com/KunalSin9h/load-gql
graphql loader reader schema
Last synced: 2 months ago
JSON representation
A tiny GraphQL schema loader, zero dependencies.
- Host: GitHub
- URL: https://github.com/KunalSin9h/load-gql
- Owner: KunalSin9h
- License: mit
- Created: 2023-10-02T17:06:32.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-10T17:27:42.000Z (over 1 year ago)
- Last Synced: 2024-08-09T06:51:30.350Z (6 months ago)
- Topics: graphql, loader, reader, schema
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@kunalsin9h/load-gql
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-graphql - load-gql - A tiny, zero dependency GraphQL schema loader from files and folders. (Implementations / JavaScript/TypeScript)
README
# load-gql
A tiny GraphQL schema loader
# Usage
Add dependency
```bash
npm i @kunalsin9h/load-gql
```Usage
```ts
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}`);
```