await server.start();
const app = express();
Start with Apollo Server for new projects as it includes GraphiQL by default and provides a superior developer experience. Appendix: Quick Reference Commands # Minimal npm install npm install graphql express graphql-http With Apollo (automatic GraphiQL) npm install @apollo/server graphql Temporary standalone (npx) npx graphiql --endpoint https://countries.trevorblades.com/graphql Global standalone (npm) npm install -g graphiql graphiql Docker docker run -p 3000:3000 -e GRAPHQL_ENDPOINT=http://localhost:4000/graphql graphiql/standalone graphiql install
app.use('/graphql', express.json(), expressMiddleware(server)); await server
// GraphQL endpoint app.all('/graphql', createHandler( schema, rootValue: root )); The standalone desktop version is ideal for testing
Run with: bash install-graphiql.sh GraphiQL installation is straightforward with any of the methods above. For most Node.js developers, the Express middleware approach (Method 1) or Apollo Server (Method 2) provides the best balance of simplicity and features. The standalone desktop version is ideal for testing remote endpoints without local server setup.
const resolvers = Query: hello: () => 'Hello from Apollo!'