Examples

Hello World Example

The simplest way to explore WunderGraph is to use the "headless" Hello World example. You can find it in the "examples" folder of our monorepo .

This example shows the bare minimum configuration to get WunderGraph up and running.

Data source configuration

As the data source, we add a single API, the SpaceX GraphQL API in this case.

1
2
3
4
5
6
7
8
9
10
11
// wundergraph.config.ts
const spaceX = introspect.graphql({
apiNamespace: 'spacex',
url: 'https://api.spacex.land/graphql/',
})
const myApplication = new Application({
name: 'app',
apis: [spaceX],
})

Operation configuration

Next, we configure a simple Operation.

1
2
3
4
5
6
7
# .wundergraph/operations/Dragons.graphql
query Dragons {
spacex_dragons {
name
active
}
}

Running the application

Now, we can run the application using npm run start and access the generated RPC API.

1
$ curl http://localhost:9991/app/main/operations/Dragons
Previous
Overview

Was this article helpful to you?
Provide feedback

Edit this page