February 16, 2023

Query HarperDB's REST API via Apollo GraphQL

Welcome to Community Posts
Click below to read the full article.
Summary of What to Expect
Table of Contents


We will launch an Apollo server with Node, and perform some read & write operations from the Apollo studio sandbox to a HarperDB instance.

  1. Set up an Apollo server with Node.js and connect it to a HarperDB instance by obtaining the instance credentials from the HarperDB Studio configuration.
  2. Clone the code from the GitHub repository and install the required dependencies.
  3. Create an .env file and add the HarperDB instance URL as an environment variable.
  4. Start the server using the npm start command and access the Apollo Studio sandbox on http://localhost:4000/.
  5. Set the authorization header in the Apollo Studio by providing the basic token obtained from HarperDB Studio.
  6. Explore the code files, including datasource.js, index.js, resolvers.js, and schema.js, which handle making API calls to HarperDB, defining the GraphQL schema, implementing resolvers, and starting the server.
  7. Perform GraphQL operations using the Apollo Studio, such as creating a schema, creating a table, adding entries to the table, retrieving records, and querying selective records from the table.
  8. Verify the results in the Apollo Studio and HarperDB Studio, and feel free to ask questions or provide feedback.