This repository demonstrates how to setup a skeleton coprocessor that simply logs the payload from the Router.
Note: To run this example, you will need a GraphOS Enterprise plan and must create
/router/.envbased on/router/.env.examplewhich exportsAPOLLO_KEYandAPOLLO_GRAPH_REF.
- Run the subgraph from the
/subgraphdirectory withnpm run dev - Run the coprocessor based on your language of choice by following the README from the appropriate
/*-coprocessordirectory (javascript, Java, golang). - In the
/routerdirectory, download the router by running./download_router.sh - In the
/routerdirectory, compose the schema by running./create_local_schema.sh - In the
/routerdirectory, 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.
In router/router-config.yaml, the coprocessor is configured with the Router to be called on the router request stage.