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.
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 }
}
}
}
}
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 |
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.
TODO
TODO