Skip to content

MichaelCurrin/github-gql-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub GraphQL JS

Starter template for querying GitHub's GQL API using Node

GitHub tag License

Made with Node.js Package - @octokit/graphql

Use this template

About

This repo demonstrates how to query GitHub's GraphQL API using Node.

The graphql NPM package is used. The content is based on the documentation here:

Installation

Clone

Clone this repo.

$ git clone git@github.com:MichaelCurrin/github-gql-js.git
$ cd github-gql-js

Install system packages

Install Node.js - see gist.

You also need make - standard on Linux and macOS. Otherwise run the commands directly in Makefile.

Install project packages

$ make install

Configuration

  1. Create a GitHub API token with appropriate permissions
  2. Copy the token value. Keep this secret and out of version control.
  3. Create a dotfile based on the template. This config file will be ignored by Git.
    $ cp .env.template .env
  4. Paste your token in the file.

Usage

$ make run

More info

GitHub APIs and tokens

GitHub GQL queries require an API token, unlike the REST API which does not.

Avoid using the browser to do your GQL queries - you'll risk exposing your token to others on the internet.

Rather run your logic using Node on a server or in a serverless function (AWS Lambda or Netlify Functions).

Resources

Related

License

Released under MIT by @MichaelCurrin.