New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphi

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphi

hapi graphql plugin

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
90
decreased by-58.33%
Maintainers
1
Weekly downloads
 
Created
Source

graphi

hapi graphql server plugin

Build Status

Usage

With promises

const schema = `
  type Person {
    firstname: String!
    lastname: String!
  }

  type Query {
    person(firstname: String!): Person!
  }
`;

const getPerson = function (args, request) {
  return new Promise((resolve) => {
    // args.firstname will be set, request is the hapi request object
    resolve({ firstname: 'billy', lastname: 'jean' });
  });
};

const resolvers = {
  person: getPerson
};

const server = new Hapi.Server();
server.connection();
server.register({ register: Graphi, options: { schema, resolvers } }, (err) => {
  // server is ready to be started
});

With callbacks

const schema = `
  type Person {
    firstname: String!
    lastname: String!
  }

  type Query {
    person(firstname: String!): Person!
  }
`;

const getPerson = function (args, request, cb) {
  cb(null, { firstname: 'billy', lastname: 'jean' });
};

const resolvers = {
  person: getPerson
};

const server = new Hapi.Server();
server.connection();
server.register({ register: Graphi, options: { schema, resolvers } }, (err) => {
  // server is ready to be started
});

Options

  • graphqlPath - HTTP path to serve graphql requests. Default is /graphql
  • graphiqlPath - HTTP path to serve the GraphiQL UI. Set to '' or false to disable. Default is /graphiql
  • schema - graphql schema either as a string or parsed schema object
  • resolvers - query and mutation functions mapped to their respective keys. Resolvers can either return a Promise or expect a callback function as the last argument and execute it when done.

Keywords

FAQs

Package last updated on 24 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc