49
loading...
This website collects cookies to deliver better user experience
REST (OpenAPI / Swagger)
GraphQL
Apollo Federation
PostgreSQL
MySQL
SQLite
SQL Server
REST(-ish) API
Postman Collections
Generated SDKs:
TypeScript
React
React Native
// first, introspect an API
const countries = introspect.graphql({
url: "https://countries.trevorblades.com/",
});
// then, prepare it for publishing it to the Hub
configurePublishWunderGraphAPI({
organization: "wundergraph",
apiName: "countries",
title: "Trevor's Countries",
markdownDescriptionFile: "countries.md",
public: true,
keywords: ["countries","trevor","trevorblades"],
apis: [
countries,
],
});
$ wundergraph publish generated/wundergraph.countries.api.json
$ wundergraph init#
$ cd .wundergraph
$ yarn
$ wunderctl integrations add wundergraph/countries wundergraph/spacex
{
"dependencies": [
"wundergraph/spacex",
"wundergraph/countries"
]
}
import {
Application,
configureWunderGraphApplication,
cors,
templates
} from "@wundergraph/sdk";
import wunderGraphHooks from "./wundergraph.hooks";
import operations from "./wundergraph.operations";
import {integrations} from "./generated/wundergraph.integrations";
const spacex = integrations.wundergraph.spacex({
apiNamespace: "spacex",
});
const countries = integrations.wundergraph.countries({
apiNamespace: "countries",
});
const myApplication = new Application({
name: "app",
apis: [
spacex,
countries,
],
});
query DragonsAndContries {
dragons: spacex_dragons {
name
active
}
countries: countries_countries {
code
name
capital
}
}
# cd into the .wundergraph directory and run:
$ wunderctl up --debug
$ curl http://localhost:9991/api/main/operations/DragonsAndContries
First, you have to decide on a technology, language and framework to build your REST API
Then, add a new endpoint to your API
Use a tool like graphql-code-generator to generate a typesafe API client for both APIs
Use the generated client to query both APIs and implement the REST Endpoint
Define a JSON Schema for the REST Endpoint
Add an authentication and authorization layer to your REST Endpoint (this is batteries included in WunderGraph)
Add a caching middleware (this is batteries included in WunderGraph)
Use curl to query the REST Endpoint