Testing Apollo Server with Typescript
A way to test GraphQL endpoints of an Apollo Server with a RESTDataSource in Typescript.
- Install dependencies
npm install
- Run typecheck, lint and tests with
npm run precommit
Notes:
- Prettier is included in the vscode settings but excluded from linting. I decided to do this so the editor doesn't get spammed with formatting errors.
- Tests don't include a typecheck. I decided to do this because it's annoying in watch mode.
This is out of scope for this exercise. For it to work you would need to start a server with a REST API with a /movies
endpoint at http://localhost:5200/
. Then you can start this server with npm start
.