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

  • import { ApolloServerPluginInlineTrace } from "apollo-server-core";
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [ApolloServerPluginInlineTrace()],
    })
    <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">ApolloServerPluginInlineTrace</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> ApolloServerPluginInlineTraceOptions</span><span class="token punctuation">)</span><span class="token operator">:</span> ApolloServerPlugin <span class="token keyword">import</span> ApolloServerPluginInlineTrace</code></pre>
    Docs
    0
  • import { ApolloServer } from "apollo-server";
    import { ApolloServerPluginInlineTrace } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        ApolloServerPluginInlineTrace({
          rewriteError: (err) => err.message.match(SENSITIVE_REGEX) ? null : err,
        }),
      ],
    });
    <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
  • import { ApolloServer } from "apollo-server";
    import { ApolloServerPluginInlineTraceDisabled } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [ApolloServerPluginInlineTraceDisabled()],
    });
    <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
  •     ApolloServerPluginUsageReporting({
          rewriteError(err) {
            // Make sure that a specific pattern is removed from all error messages.
            err.message = err.message.replace(/x-api-key:[A-Z0-9-]+/, "REDACTED");
            return err;
          }
        }),
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> ApolloServerPluginUsageReporting<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>any</span><span class="token punctuation">></span></span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> apollo<span class="token operator">-</span>server<span class="token operator">-</span>core<span class="token punctuation">.</span>ApolloServerPluginUsageReportingOptions<span class="token operator">&lt;</span>any<span class="token operator">></span></span><span class="token punctuation">)</span> <span class="token operator">=></span> ApolloServerPlugin<span class="token operator">&lt;</span>BaseContext<span class="token operator">></span></code></pre>
    Docs
    0
  •     ApolloServerPluginUsageReporting({
          rewriteError(err) {
            // Return `null` to avoid reporting `AuthenticationError`s
            if (err instanceof AuthenticationError) {
              return null;
            }
    
            // All other errors will be reported.
            return err;
          }
        }),
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> ApolloServerPluginUsageReporting<span class="token operator">:</span> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>any</span><span class="token punctuation">></span></span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">?</span><span class="token operator">:</span> apollo<span class="token operator">-</span>server<span class="token operator">-</span>core<span class="token punctuation">.</span>ApolloServerPluginUsageReportingOptions<span class="token operator">&lt;</span>any<span class="token operator">></span></span><span class="token punctuation">)</span> <span class="token operator">=></span> ApolloServerPlugin<span class="token operator">&lt;</span>BaseContext<span class="token operator">></span></code></pre>
    Docs
    0
  • import { ApolloServer } from "apollo-server";
    import { ApolloServerPluginUsageReporting } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        // Sets a non-default option on the usage reporting plugin
        ApolloServerPluginUsageReporting({
          sendVariableValues: { all: true },
        }),
      ],
    });
    <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
  • new ApolloServer({
      plugins: [
        ApolloServerPluginSchemaReporting({
          overrideReportedSchema: schema
        }),
        ApolloServerPluginUsageReporting({
          overrideReportedSchema: schema
        }),
      ],
    })
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token builtin">any</span></code></pre>
    Docs
    0
  • import { ApolloServer } from "apollo-server";
    import { ApolloServerPluginUsageReporting } from "apollo-server-core";
    
    const server = new ApolloServer({
      typeDefs,
      resolvers,
      plugins: [
        ApolloServerPluginUsageReporting({
          sendVariableValues: { all: true },
        }),
      ],
    });
    <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
  • 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
  • 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 { 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
  • 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
  • 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
  • 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
  • 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
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples