GraphQL directives can eliminate repetitive boilerplate in server implementations. Two practical use cases are covered: computing derived fields using the `graphql-directive-computed-property` library (which lets you define computed properties in the schema without touching resolvers), and integrating REST APIs using `graphql-directive-rest` (which removes the need to write fetch-based resolvers entirely by annotating fields with `@rest`). A template repository is also provided for building custom directives using Apollo Server Express and Jest.

5m read timeFrom callstack.com
Post cover image
Table of contents
Computing custom propertiesHow to create your own directivesSumming up

Sort: