Skip to content

This repository demonstrates how to setup a skeleton coprocessor that simply logs the payload from the Router.

License

Notifications You must be signed in to change notification settings

apollosolutions/example-coprocessor-helloworld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a1d3721 · Dec 10, 2024

History

20 Commits
May 2, 2024
Apr 8, 2024
Apr 3, 2024
Mar 19, 2024
Oct 7, 2024
May 2, 2024
Apr 3, 2024
Apr 3, 2024
Apr 3, 2024
Mar 15, 2024
Apr 8, 2024
Dec 10, 2024

Repository files navigation

Coprocessor "Hello World"

This repository demonstrates how to setup a skeleton coprocessor that simply logs the payload from the Router.

Running the Example

Note: To run this example, you will need a GraphOS Enterprise plan and must create /router/.env based on /router/.env.example which exports APOLLO_KEY and APOLLO_GRAPH_REF.

  1. Run the subgraph from the /subgraph directory with npm run dev
  2. Run the coprocessor based on your language of choice by following the README from the appropriate /*-coprocessor directory (javascript, Java, golang).
  3. In the /router directory, download the router by running ./download_router.sh
  4. In the /router directory, compose the schema by running ./create_local_schema.sh
  5. In the /router directory, run the router by running ./start_router.sh

Now if you run this code in the browser (http://127.0.0.1:4000/), you will be able to query the router and you will see the payload logged in the terminal by the coprocessor.

Code Highlights

Coprocessor Configuration

In router/router-config.yaml, the coprocessor is configured with the Router to be called on the router request stage.

Coprocessor

About

This repository demonstrates how to setup a skeleton coprocessor that simply logs the payload from the Router.

Resources

License

Stars

Watchers

Forks