Skip to content

Commit d4727b5

Browse files
Update README.md
1 parent 1b5f468 commit d4727b5

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ If the server that you are running GraphQL Rest Router on requires a proxy to co
147147
### Advanced Configuration of GraphQL Rest Router
148148
GraphQL Rest Router takes an optional third parameter during initialization that allows you to control default cache, headers, authentication and proxies
149149

150-
```
150+
```js
151151
const options = {
152152
defaultCacheTimeInMs: 3000,
153153
};
@@ -156,11 +156,20 @@ new GraphQLRestRouter(endpoint, schema, options);
156156
```
157157

158158
A list of options and their default values is below:
159-
**TODO TABLE HERE**
160159

161-
### Creating Endpoints
160+
| Property | Type | Default | Description |
161+
| --- | --- | --- | --- |
162+
| defaultCacheTimeInMs | number | 0 | If a cache engine has been provided use this as a default value for all routes and endpoints. If a route level cache time has been provided this value will be ignored |
163+
| defaultTimeoutInMs | number | 10000 | The amount of time to allow for a request to the GraphQL to wait before timing out an endpoint |
164+
| autoDiscoverEndpoints | boolean | false | When set to true, GQL Rest Router will scan the provided client schema you provide and automatically mount an endpoint for each operation name / named query |
165+
| optimizeQueryRequest | boolean | false | (BETA) When set to true, GQL Rest Router will split up the provided schema into the smallest fragment necessary to complete each request to the GraphQL server as opposed to sending the originally provided schema with each request|
166+
| headers | object | {} | Any headers provided here will be sent with each request to GraphQL. If headers are also set at the route level, they will be combined with these headers (Route Headers take priority over Global Headers) |
167+
| passThroughHeaders | array<string> | [] | An array of strings that indicate which headers to pass through from the request to GraphQL Rest Router to the GraphQL Server. (Example: ['x-context-jwt']) |
168+
| auth | [AxiosBasicCredentials](https://github.com/axios/axios/blob/master/index.d.ts#L9-L12) | null | If the GraphQL server is protected with basic auth provide the basic auth credentials here to allow GQL Rest Router to connect. (Example: { username: 'pesto', password: 'foobar' } |
169+
| proxy | [AxiosProxyConfig](https://github.com/axios/axios/blob/master/index.d.ts#L14-L22) | null | If a proxy is required to communicate with your GraphQL server from the server that GQL Rest Router is running on, provide it here. |
170+
| cacheEngine | ICacheEngine | null | Either a cache engine that [ships default](#Caching) with GQL Rest Router or adheres to the [ICacheEngine interface](#Custom-Cache-Engine) |
162171

163-
### GET / POST
172+
### Creating Endpoints
164173

165174
## Caching
166175
GraphQL Rest Router ships with two cache interfaces stock and supports any number of custom or third party caching interfaces as long as they adhere to `ICacheInterface`
@@ -187,6 +196,11 @@ api.mount('GetUser', { cacheTimeInMs: 500 });
187196
### Redis Cache
188197
As of the time of this writing, a REDIS interface for GQL Rest Router is not yet available. Feel free to submit a PR.
189198

199+
### Custom Cache Engine
200+
If you have a unique cache situation, or use a cache that does not ship by default with GQL Rest Router, you may implement a custom cache as long as it adheres to the ICacheEngine interface.
201+
202+
Simply said, provide an object that contains `get` and `set` functions. See `InMemoryCache.ts` as an example.
203+
190204
## Swagger / Open API
191205
As GraphQL Rest Router exposes your API with new routes that aren't covered by GraphQL's internal documentation or introspection queries, GraphQL Rest Router ships with support for Swagger (Open Api V2), Open API (V3) and API Blueprint (planned). When mounting a documentation on GraphQL Rest Router, it will automatically inspect all queries in the schema you provided and run an introspection query on your GraphQL server to dynamically assemble and document the types / endpoints.
192206

@@ -227,8 +241,6 @@ api.mount(swaggerDocumentation).at('/docs/swagger');
227241
### API Blueprint
228242
Planned for V1 but not available in Alpha
229243

230-
## Custom Routes
231-
232244
## Usage with Web Frameworks
233245
Currently GQL Rest Router only supports Express out of the box. Please submit a PR or an Issue if you would like to see GQL Rest Router support additional frameworks.
234246

@@ -258,7 +270,7 @@ app.listen(3000);
258270
```
259271

260272
### Usage with KOA
261-
As of the time of this writing, a KOA extension for GQL Rest Router is not yet available. Feel free to submit a PR.
273+
As of the time of this writing, a KOA extension for GQL Rest Router is not available. Feel free to submit a PR.
262274

263275
### Code Examples
264276
See the [examples folder](/examples) in this repo for code examples.

0 commit comments

Comments
 (0)