Skip to content

coalmines/coalmines-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coal Mines API

Build Status

Description

This service exposes a GraphQL API via HTTP. It provides the main gateway for client applications. It does not implement business logic. To separate concerns, this service honors the main ideas behind GraphQL.

The HTTP endpoints are defined through Koa.

Live Version

A live version of this project can be found at coalmines.ruhr.

UI

As of Apollo Server 2, GraphQL Playground is available on /graphql as a UI. However, it is not sending cookies, breaking cookie-based authentication. For a workaround, open the settings in the UI (gear icon in the upper right), and set "request.credentials": "same-origin".

For a consistent user experience, GraphiQL is still available on /graphiql.

Requirements

  • Node.js
  • npm
  • Babel CLI tools

Environment Variables

See env.sh. Set NODE_ENV to production for production mode.

OAuth Support

For authentication integration, you will need to set up the app for the respective authentication provider first. Then set APP_URL to match the protocol and host where you deployed the app, e.g., https://coalmines.ruhr. For each provider, set the environment variables for the credentials to the respective values the provider gives you.

Providers supported:

  • GitHub: GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET
  • Twitter: TWITTER_CONSUMER_KEY and TWITTER_CONSUMER_SECRET

Logging

By default, log output is in plain console format. When running this service in production mode, the output is in JSON format.

Health Check

A health check endpoint implementing Nadareishvili's IETF draft is available at /.well-known/apollo/server-health.

Running and Building

To run the app, set the necessary environment variables based on the file env.sh.

Run the application in watch mode for development purposes:

npm start

Building the Application

You should provide the requirements as stated above through your build system.

make distclean && make

If your binaries are in paths other than defined in the Makefile, you can specify them, for example:

make distclean && make NODE=/usr/local/bin/node8

To create a tarball (by default put in build/bundle.tar.gz):

make dist

TL;DR

make distclean && make && make dist