Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

apicollective/graphql-rest-proxy

Repository files navigation

graphql-rest-proxy

Build Status

graphql-rest-proxy is a GraphQL server that proxies all requests to a REST API, and handles the translation of data. It reads a number of configuration files, and constructs a schema and object graph.

Configuration

The configuration format is similar to APIBuilder.

Define your base_url:

"base_url": "https://swapi.co/api",

Define your models:

"models": {
  "people": {
    "description": "a person in the star wars universe",
    "fields": [
      { "name": "gender", "type": "string", "description": "male, female, unknown, or n/a" },
      ...
    ]
  }
},

Define your resources:

"resources": {
  "people": {
    "many": {
      "path": "/people",
      "extract": "$.results",
      "params": {
        "search": { "type": "string", "required": false },
        "page": { "type": "integer", "required": false, "default": 1 }
      }
    }
  }
}

Valid Types

Type string GraphQL Type
boolean Boolean
date Date
date-time-iso8601 DateTime
double Float
integer Int
json JSON
long Long
string String
object Object
unit Unit
uuid ID

Authentication

The only currently supported method of API authentication is by proxying the Authorization HTTP header from the GraphQL server to the REST backend. This is automatically done on every request.

Resources and Parameters

TODO

Links

TODO

Releases

No releases published

Packages

No packages published