How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • const { 
      ApolloServerPluginLandingPageProductionDefault
      ApolloServerPluginLandingPageLocalDefault,
    } = require('apollo-server-core');
        process.env.NODE_ENV === 'production' ?
          ApolloServerPluginLandingPageProductionDefault({ footer: false }) :
          ApolloServerPluginLandingPageLocalDefault({ footer: false })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageProductionDefault</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageProductionDefaultOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageProductionDefault</code></pre>
    Docs
    0
  • const {   ApolloServerPluginLandingPageProductionDefault  ApolloServerPluginLandingPageLocalDefault,} = require('apollo-server-core');
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        process.env.NODE_ENV === 'production' ?      ApolloServerPluginLandingPageProductionDefault({ footer: false }) :      ApolloServerPluginLandingPageLocalDefault({ footer: false })  ]
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageProductionDefault</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageProductionDefaultOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageProductionDefault</code></pre>
    Docs
    0
  • import { ApolloServer } from "apollo-server";
    import { ApolloServerPluginLandingPageLocalDefault,
             ApolloServerPluginLandingPageProductionDefault
    } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        // Install a landing page plugin based on NODE_ENV
        process.env.NODE_ENV === 'production'
          ? ApolloServerPluginLandingPageProductionDefault({
              graphRef: "my-graph-id@my-graph-variant",
              footer: false,
            })
          : ApolloServerPluginLandingPageLocalDefault({ footer: false }),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">class</span> <span class="token class-name">ApolloServer</span> <span class="token keyword">import</span> ApolloServer</code></pre>
    Docs
    0
  • const { 
      ApolloServerPluginLandingPageProductionDefault
      ApolloServerPluginLandingPageLocalDefault,
    } = require('apollo-server-core');
        process.env.NODE_ENV === 'production' ?
          ApolloServerPluginLandingPageProductionDefault({ footer: false }) :
          ApolloServerPluginLandingPageLocalDefault({ footer: false })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageProductionDefault</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageProductionDefaultOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageProductionDefault</code></pre>
    Docs
    0
  • const {   ApolloServerPluginLandingPageProductionDefault  ApolloServerPluginLandingPageLocalDefault,} = require('apollo-server-core');
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        process.env.NODE_ENV === 'production' ?      ApolloServerPluginLandingPageProductionDefault({ footer: false }) :      ApolloServerPluginLandingPageLocalDefault({ footer: false })  ]
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageProductionDefault</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageProductionDefaultOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageProductionDefault</code></pre>
    Docs
    0
  • import { ApolloServer } from "apollo-server";
    import { ApolloServerPluginLandingPageLocalDefault,
             ApolloServerPluginLandingPageProductionDefault
    } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        // Install a landing page plugin based on NODE_ENV
        process.env.NODE_ENV === 'production'
          ? ApolloServerPluginLandingPageProductionDefault({
              graphRef: "my-graph-id@my-graph-variant",
              footer: false,
            })
          : ApolloServerPluginLandingPageLocalDefault({ footer: false }),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">class</span> <span class="token class-name">ApolloServer</span> <span class="token keyword">import</span> ApolloServer</code></pre>
    Docs
    0
  • const { ApolloServerPluginLandingPageDisabled } = require('apollo-server-core');
        ApolloServerPluginLandingPageDisabled()
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageDisabled</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageDisabled</code></pre>
    Docs
    0
  • const { ApolloServerPluginLandingPageDisabled } = require('apollo-server-core');
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        ApolloServerPluginLandingPageDisabled()  ]
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageDisabled</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageDisabled</code></pre>
    Docs
    0
  • import { ApolloServerPluginLandingPageDisabled } from 'apollo-server-core';
    new ApolloServer({
      plugins: [
        ApolloServerPluginLandingPageDisabled(),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageDisabled</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageDisabled</code></pre>
    Docs
    0
  • import { ApolloServerPluginLandingPageGraphQLPlayground,
             ApolloServerPluginLandingPageDisabled } from 'apollo-server-core';
    new ApolloServer({
      plugins: [
        process.env.NODE_ENV === 'production'
          ? ApolloServerPluginLandingPageDisabled()
          : ApolloServerPluginLandingPageGraphQLPlayground(),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageGraphQLPlayground</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageGraphQLPlaygroundOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageGraphQLPlayground</code></pre>
    Docs
    0
  • import { ApolloServer } from "apollo-server";
    import {
      ApolloServerPluginLandingPageDisabled
    } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        ApolloServerPluginLandingPageDisabled(),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">class</span> <span class="token class-name">ApolloServer</span> <span class="token keyword">import</span> ApolloServer</code></pre>
    Docs
    0
  • const { ApolloServerPluginLandingPageGraphQLPlayground } = require('apollo-server-core');
        ApolloServerPluginLandingPageGraphQLPlayground({
          // options
        })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageGraphQLPlayground</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageGraphQLPlaygroundOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageGraphQLPlayground</code></pre>
    Docs
    0
  • import { ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core';
    new ApolloServer({
      plugins: [
        ApolloServerPluginLandingPageGraphQLPlayground(),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageGraphQLPlayground</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageGraphQLPlaygroundOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageGraphQLPlayground</code></pre>
    Docs
    0
  • import { ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core';
    new ApolloServer({
      plugins: [
        ApolloServerPluginLandingPageGraphQLPlayground({
          settings: {
            'some.setting': true,
            'general.betaUpdates': false,
            'editor.theme': 'dark',
            'editor.cursorShape': 'line',
            'editor.reuseHeaders': true,
            'tracing.hideTracingResponse': true,
            'queryPlan.hideQueryPlanResponse': true,
            'editor.fontSize': 14,
            'editor.fontFamily': `'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace`,
            'request.credentials': 'omit',
          },
        }),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageGraphQLPlayground</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageGraphQLPlaygroundOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageGraphQLPlayground</code></pre>
    Docs
    0
  • const { ApolloServerPluginLandingPageGraphQLPlayground } = require('apollo-server-core');
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        ApolloServerPluginLandingPageGraphQLPlayground({      // options    })  ]
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageGraphQLPlayground</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageGraphQLPlaygroundOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageGraphQLPlayground</code></pre>
    Docs
    0
  • import { ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core';
    new ApolloServer({
      plugins: [
        ApolloServerPluginLandingPageGraphQLPlayground(playgroundOptions),
      ],
    });
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ApolloServerPluginLandingPageGraphQLPlayground</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginLandingPageGraphQLPlaygroundOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginLandingPageGraphQLPlayground</code></pre>
    Docs
    0
  • import { ApolloServer } from 'apollo-server-express';
    import { ApolloServerPluginDrainHttpServer } from 'apollo-server-core';
    import express from 'express';
    import http from 'http';
    
    async function startApolloServer(typeDefs, resolvers) {
      const app = express();
      const httpServer = http.createServer(app);
      const server = new ApolloServer({
        typeDefs,
        resolvers,
        plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
      });
      await server.start();
      server.applyMiddleware({ app });
      await new Promise<void>(resolve => httpServer.listen({ port: 4000 }, resolve));
      console.log(`๐Ÿš€ Server ready at http://localhost:4000${server.graphqlPath}`);
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">import</span> ApolloServer</code></pre>
    Docs
    0
  • import { ApolloServer } from 'apollo-server-express';
    import { ApolloServerPluginDrainHttpServer } from 'apollo-server-core';
    import express from 'express';
    import http from 'http';
    
    async function startApolloServer(typeDefs, resolvers) {
      // Required logic for integrating with Express
      const app = express();
      const httpServer = http.createServer(app);
    
      // Same ApolloServer initialization as before, plus the drain plugin.
      const server = new ApolloServer({
        typeDefs,
        resolvers,
        plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
      });
    
      // More required logic for integrating with Express
      await server.start();
      server.applyMiddleware({
        app,
    
        // By default, apollo-server hosts its GraphQL endpoint at the
        // server root. However, *other* Apollo Server packages host it at
        // /graphql. Optionally provide this to match apollo-server.
        path: '/'
      });
    
      // Modified server startup
      await new Promise<void>(resolve => httpServer.listen({ port: 4000 }, resolve));
      console.log(`๐Ÿš€ Server ready at http://localhost:4000${server.graphqlPath}`);
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">import</span> ApolloServer</code></pre>
    Docs
    0
  • import { ApolloServer } from 'apollo-server-fastify';
    import { ApolloServerPluginDrainHttpServer } from 'apollo-server-core';
    import fastify, { FastifyInstance } from 'fastify';
    
    function fastifyAppClosePlugin(app: FastifyInstance): ApolloServerPlugin {
      return {
        async serverWillStart() {
          return {
            async drainServer() {
              await app.close();
            },
          };
        },
      };
    }
    
    async function startApolloServer(typeDefs, resolvers) {
      const app = fastify();
      const server = new ApolloServer({
        typeDefs,
        resolvers,
        plugins: [
          fastifyAppClosePlugin(app),
          ApolloServerPluginDrainHttpServer({ httpServer: app.server }),
        ],
      });
    
      await server.start();
      app.register(server.createHandler());
      await app.listen(4000);
      console.log(`๐Ÿš€ Server ready at http://localhost:4000${server.graphqlPath}`);
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">import</span> ApolloServer</code></pre>
    Docs
    0
  • const express = require('express');
    const { ApolloServer } = require('apollo-server-express');
    const { ApolloServerPluginDrainHttpServer } = require('apollo-server-core');
    const { typeDefs, resolvers } = require('./schema');
    const http = require('http');
    
    async function startApolloServer() {
      const app = express();
      const httpServer = http.createServer(app);
      const server = new ApolloServer({
        typeDefs,
        resolvers,
        plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
      });
    
      await server.start();
    
      // Mount Apollo middleware here.
      server.applyMiddleware({ app });
      await new Promise<void>(resolve => httpServer.listen({ port: 4000 }, resolve));
      console.log(`๐Ÿš€ Server ready at http://localhost:4000${server.graphqlPath}`);
      return { server, app };
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">express</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> core<span class="token punctuation">.</span><span class="token function">Express</span> <span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">namespace</span> express <span class="token keyword">import</span> express</code><div class="typing-tooltip-markup">Creates an Express application. The express() function is a top-level function exported by the express module.</div></pre>
    Docs
    0
  • const express = require('express');
    const { ApolloServer } = require('apollo-server-express');
    const { ApolloServerPluginDrainHttpServer } = require('apollo-server-core');
    const { typeDefs, resolvers } = require('./schema');
    
    async function startApolloServer() {
      const app = express();
      const httpServer = http.createServer(app);
      const server = new ApolloServer({
        typeDefs,
        resolvers,
        plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
      });
    
      await server.start();
    
      // Additional middleware can be mounted at this point to run before Apollo.
      app.use('*', jwtCheck, requireAuth, checkScope);
    
      // Mount Apollo middleware here.
      server.applyMiddleware({ app, path: '/specialUrl' });
      await new Promise<void>(resolve => httpServer.listen({ port: 4000 }, resolve));
      console.log(`๐Ÿš€ Server ready at http://localhost:4000${server.graphqlPath}`);
      return { server, app };
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">express</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> core<span class="token punctuation">.</span><span class="token function">Express</span> <span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">namespace</span> express <span class="token keyword">import</span> express</code><div class="typing-tooltip-markup">Creates an Express application. The express() function is a top-level function exported by the express module.</div></pre>
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples