Skip to content

Commit 8f6f6ba

Browse files
2 parents fc4594d + 950d5b7 commit 8f6f6ba

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ api.listen(3000, () => {
3636
- [Examples](#code-examples)
3737

3838
# Overview
39-
GraphQL has gained addoption as a replacement to the conventional REST API and for good reason. Development Time/Time to Market are signficantly shortened when no longer requiring every application to build and maintain its own API.
39+
GraphQL has gained adoption as a replacement to the conventional REST API and for good reason. Development Time/Time to Market are signficantly shortened when no longer requiring every application to build and maintain its own API.
4040

4141
## Internal GraphQL API
4242
While GraphQL has gained traction recently, the majority of GraphQL endpoints are used internally and not distributed or endorsed for public use. Items such as authentication, permissions, priveleges and sometimes even performance on certain keys are not seen as primary concerns as the API is deemed "internal". Because of this, any exposure of your GraphQL server to the public internet exposes you to risk (e.g. DDOS by allowing unknown users to create their own non-performant queries, accidental exposure of sensitive data, etc).
@@ -76,7 +76,7 @@ api.listen(3000);
7676
See [Usage with Express](#usage-with-express) and read [Getting Started](#getting-started) to see all available options.
7777

7878
## External GraphQL API
79-
When dealing with a publicly exposed GraphQL server that implements users and priveleges, the main benefit GraphQL Rest Client provides is caching. While implementing individual caches at a content-level with push-expiration in the GraphQL server is optimal, building these systems is laborous and isn't always prioritized in an MVP product. GraphQL Rest Client allows you to expose a GraphQL query as a REST endpoing with built in cache management that is compatible with all CDNs and cache management layers (e.g. CloudFlare, Akamai, Varnish, etc).
79+
When dealing with a publicly exposed GraphQL server that implements users and priveleges, the main benefit GraphQL Rest Client provides is caching. While implementing individual caches at a content-level with push-expiration in the GraphQL server is optimal, building these systems is laborous and isn't always prioritized in an MVP product. GraphQL Rest Client allows you to expose a GraphQL query as a REST endpoint with built-in cache management that is compatible with all CDNs and cache management layers (e.g. CloudFlare, Akamai, Varnish, etc).
8080

8181
One line of GraphQL Rest Router code allows you to take
8282
```gql
@@ -272,17 +272,16 @@ A list of options and their default values is below:
272272
| 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']) |
273273
| 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' } |
274274
| 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. |
275-
| cacheEngine | ICacheEngine | null | Either a cache engine that [ships default](#Caching) with GQL Rest Router or adheres to the [ICacheEngine interface](#Custom-Cache-Engine) |
275+
| cacheEngine | [ICacheEngine](https://github.com/Econify/graphql-rest-router/blob/master/index.d.ts#L81-L84) | null | Either a cache engine that [ships default](#Caching) with GQL Rest Router or adheres to the [ICacheEngine interface](#Custom-Cache-Engine) |
276276

277277
## Caching
278-
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`
278+
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 [ICacheEngine](https://github.com/Econify/graphql-rest-router/blob/master/index.d.ts#L81-L84)
279279

280280
### In Memory Cache
281281
InMemoryCache stores your cached route data on your server in memory. This can be used in development or with low TTLs in order to prevent a [thundering herd](https://en.wikipedia.org/wiki/Thundering_herd_problem) however it is strongly discouraged to use this in production. In Memory caches have the ability to deplete your system's resources and take down your instance of GraphQLRestRouter.
282282

283283
```js
284-
import GraphQLRestRouter from 'graphql-rest-router';
285-
import InMemoryCache from 'graphql-rest-router/InMemoryCache';
284+
import GraphQLRestRouter, { InMemoryCache } from 'graphql-rest-router';
286285

287286
const api = new GraphQLRestRouter('http://localhost:1227', schema, {
288287
cacheEngine: new InMemoryCache(),
@@ -309,7 +308,7 @@ As GraphQL Rest Router exposes your API with new routes that aren't covered by G
309308

310309
### Open API (Preferred)
311310
```js
312-
const OpenApi = require('graphql-rest-router/OpenApi');
311+
const { OpenApi } = require('graphql-rest-router');
313312

314313
const documentation = new OpenApi.V3({
315314
title: 'My REST API', // REQUIRED!
@@ -326,7 +325,7 @@ api.mount(documentation).at('/docs/openapi');
326325

327326
### Swagger
328327
```js
329-
const OpenApi = require('graphql-rest-router/OpenApi');
328+
const { OpenApi } = require('graphql-rest-router');
330329

331330
const swaggerDocumentation = new OpenApi.V2({
332331
title: 'My REST API', // REQUIRED!

0 commit comments

Comments
 (0)