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 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 };
    }
    Docs
  • 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 };
    }
    Docs
  • 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}`);
    }
    Docs
  • //...
    const app = express();
    
    // Apollo Server setup
    const server = new ApolloServer({ typeDefs, resolvers });
    
    // Apply the Apollo GraphQL middleware and set the path to /api
    
    //...
    
    /javascripteverywhere/api MIT
  • import { ApolloServer } from "apollo-server";
    
    async function startApolloServer(typeDefs, resolvers) {
      const server = new ApolloServer({ typeDefs, resolvers });
      const { url } = await server.listen();
      console.log(`🚀 Server ready at ${url}`);
    }
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples