Commitspark is a set of tools to manage structured data with Git through a GraphQL API.
This repository contains example code that exposes the Commitspark GraphQL API over HTTP using Express and GitHub as Git provider.
-
Run
npm install
. -
Obtain a GitHub access token (classic or fine-grained) according to the GitHub adapter documentation.
-
Get the repository owner and repository name for your targeted repository.
For example, a repository at
https://github.com/my-org/my-repository
has ownermy-org
and repository namemy-repository
. -
Copy
.env.dist
to.env
and fill in your repository owner, name, and GitHub access token. -
Compile the code with
npm run build
. -
Run your server with
npm run start
.
After starting the server, the Commitspark GraphQL endpoint is available under http://localhost:3000/main/graphql and the generated GraphQL schema as plaintext under http://localhost:3000/main/schema .
In both cases, main
can be replaced with any URL-encoded ref (commit hash),
branch name or tag name to traverse to any point in your repository's commit tree. See
the GraphQL API for more information on making API calls.