Build the mental model
Apollo Server is a Node.js library implementing the GraphQL spec; giving it `typeDefs` (an SDL string) and `resolvers` (an object map) is enough for a working server. The `startStandaloneServer` helper handles HTTP server setup, CORS, and body parsing with sensible defaults, making it the easiest entry point for getting started — production deployments more often integrate with Express or Fastify.
Connect it to a real scenario
Write the Tutorial Platform API with `typeDefs` (a Tutorial type and tutorials query) and `resolvers` (a function reading from an in-memory or database repository), and run it on port 4000. After `npm run dev`, open Apollo Sandbox in the browser to test the query live.
Try the working example
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';
const typeDefs = `#graphql
type Tutorial {
id: ID!
title: String!
}
type Query {
tutorials: [Tutorial!]!
}
`;
const resolvers = {
Query: {
tutorials: () => tutorialRepository.findAll(),
},
};
const server = new ApolloServer({ typeDefs, resolvers });
const { url } = await startStandaloneServer(server, { listen: { port: 4000 } });
console.log(`Tutorial Platform API ready at ${url}`);You can run a local Apollo Server and issue a query from Apollo Sandbox.5-minute try-it
Add a `tutorial(id: ID!): Tutorial` field to the `Query` type and write its resolver function.
One important caution
A typo mismatch between a type name in `typeDefs` (`Tutorial`) and the corresponding key in `resolvers` means the server silently falls back to a default resolver instead of calling yours — a hard-to-spot bug.
Apollo Server — Getting Started — GraphQL