REST is the most commonly used style to build public APIs. With WunderGraph, you're able to turn any REST API specified by an OpenAPI Specification into a GraphQL API. This way, you can treat it like any other GraphQL API and even stitch it together with other APIs.
Add a REST API
To add a REST data source, edit
.wundergraph/wundergraph.config.ts and introspect the API like the config below.
The REST data source is now added to your virtual graph and you can now write operations against it.
Write an operation
Create a new file
Countries.graphql in the
operations folder and add the following content:
Run the query
Queries are simply HTTP endpoints on your WunderGraph server.