Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove GraphQL service empty resource requirement; add option to change playground endpoint #647

Merged
merged 4 commits into from
May 30, 2022

Conversation

crookse
Copy link
Member

@crookse crookse commented May 29, 2022

Closes #646

TODO

Summary

  • refactor: GraphQLService creates the GraphQL playground resource at startup time
  • feat: add option playground_path to allow user to define different GraphQL playground endpoint
  • test: updates GraphQLService test

Example Usage

// app.ts

import { Drash, GraphQL, GraphQLService } from "./deps.ts";

// Set up your GraphQL environment

const schema = GraphQL.buildSchema(`
  type Query {
    greeting: String
  }
`);

const root = {
  greeting: () => { // or greeting: (source, args, context, info) => {
    return "Hello world!";
  },
};

// Instantiate the GraphQL service

const graphQl = new GraphQLService({
  schema,
  graphiql: true,
  rootValue: root,
});

const server = new Drash.Server({
  hostname: "localhost",
  port: 1447,
  protocol: "http",
  resources: [],
  services: [graphQl],
});

server.run();

console.log(`Server running at ${server.address}.`);

@crookse crookse added the Type: Minor Merging this pull request results in a minor version increment label May 29, 2022
@crookse crookse merged commit f501647 into main May 30, 2022
@crookse crookse deleted the feat/remove-graphql-service-resource branch July 1, 2022 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Minor Merging this pull request results in a minor version increment
Development

Successfully merging this pull request may close these issues.

feat: graphql service no longer needs empty resource; add option to define playground endpoint
2 participants