How to use apollo-server-hapi - 6 common examples

To help you get started, we’ve selected a few apollo-server-hapi 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 Codebrahma / gamification-platform-backend / plugins.js View on Github external
plugins.push({
		plugin: appoloServer.graphqlHapi,
		options: {
			path: '/graphql',
			graphqlOptions: {
				schema: executableSchema,
			},
			route: {
				cors: true,
			},
		},
	});

	// graphiql interface
	plugins.push({
		plugin: appoloServer.graphiqlHapi,
		options: {
			path: '/graphiql',
			graphiqlOptions: {
				schema: executableSchema,
				endpointURL: '/graphql',
			},
		},
	});
}

module.exports = plugins;
github Codebrahma / gamification-platform-backend / plugins.js View on Github external
const appoloServer = require('apollo-server-hapi');

const executableSchema = require('./server/graphQL/executableSchema');

const DEVELOPMENT = 'development';

/**
 * exports array of plugins with configuration.
 * @type {Array}
 */
const plugins = [];

if (config.util.getEnv('NODE_ENV') === DEVELOPMENT) {
	// HAPI Graphql for HTTP endpoints
	plugins.push({
		plugin: appoloServer.graphqlHapi,
		options: {
			path: '/graphql',
			graphqlOptions: {
				schema: executableSchema,
			},
			route: {
				cors: true,
			},
		},
	});

	// graphiql interface
	plugins.push({
		plugin: appoloServer.graphiqlHapi,
		options: {
			path: '/graphiql',
github ArkEcosystem / core / packages / core-graphql / lib / schema.js View on Github external
'use strict';

const { ApolloServer } = require('apollo-server-hapi')
const resolvers = require('./resolvers')
const typeDefs = require('./defs')

/**
 * Schema used by the Apollo GraphQL plugin for the hapi.js server.
 */
module.exports = new ApolloServer({
  typeDefs,
  resolvers
})
github ArkEcosystem / core / deprecated / core-graphql / src / apollo-server.ts View on Github external
import { ApolloServer } from "apollo-server-hapi";
import { typeDefs } from "./defs";
import { resolvers } from "./resolvers";

/**
 * Schema used by the Apollo GraphQL plugin for the hapi.js server.
 */
export const apolloServer = new ApolloServer({
    typeDefs,
    resolvers,
});
github itsezc / CycloneIO / packages / server / source / network / api / APIServer.ts View on Github external
//This should be in the config
            port: 8087
        }
    )

    const schema = makeExecutableSchema(
        {
            typeDefs,
            resolvers,
            resolverValidationOptions: {
                requireResolversForResolveType: false
            }
        }
    )

    const apolloServer = new ApolloServer(
        {
            schema,
            context: {
                db: prisma
            }
        }
    )

    await apolloServer.applyMiddleware({
        app: api
    })

    await apolloServer.installSubscriptionHandlers(api.listener)

    return api
 }
github itsezc / CycloneIO / packages / server / source / network / api / APIServer.ts View on Github external
export const createAPIServer = async (config: CycloneConfig): Promise => {
    const api = new Hapi.Server(
        {
            //This should be in the config
            port: 8087
        }
    )

    const schema = makeExecutableSchema(
        {
            typeDefs,
            resolvers,
            resolverValidationOptions: {
                requireResolversForResolveType: false
            }
        }
    )

    const apolloServer = new ApolloServer(
        {
            schema,
            context: {
                db: prisma
            }
        }

apollo-server-hapi

Production-ready Node.js GraphQL server for Hapi

MIT
Latest version published 9 months ago

Package Health Score

82 / 100
Full package analysis