{"id":13880722,"url":"https://github.com/Econify/graphql-rest-router","last_synced_at":"2025-07-16T17:31:06.201Z","repository":{"id":33930382,"uuid":"163690022","full_name":"Econify/graphql-rest-router","owner":"Econify","description":"Expose and cache an internal GraphQL Server as a self-documenting REST API without exposing the schema.","archived":false,"fork":false,"pushed_at":"2023-03-06T09:41:16.000Z","size":871,"stargazers_count":37,"open_issues_count":16,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-06-14T19:46:55.769Z","etag":null,"topics":["api","cache","graphql","graphql-cache","graphql-rest","graphql-server","rest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Econify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-31T18:29:55.000Z","updated_at":"2022-09-26T18:54:14.000Z","dependencies_parsed_at":"2024-06-21T15:35:37.115Z","dependency_job_id":"afc54d05-5497-4f64-b48c-4aaddcb78fe3","html_url":"https://github.com/Econify/graphql-rest-router","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Econify/graphql-rest-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Econify%2Fgraphql-rest-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Econify%2Fgraphql-rest-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Econify%2Fgraphql-rest-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Econify%2Fgraphql-rest-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Econify","download_url":"https://codeload.github.com/Econify/graphql-rest-router/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Econify%2Fgraphql-rest-router/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265527545,"owners_count":23782480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cache","graphql","graphql-cache","graphql-rest","graphql-server","rest"],"created_at":"2024-08-06T08:03:25.591Z","updated_at":"2025-07-16T17:31:05.876Z","avatar_url":"https://github.com/Econify.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# GraphQL Rest Router\n\nGraphQL Rest Router allows you to expose an internal GraphQL API as a REST API without exposing the entire schema with a simple DSL.\n\n```js\nimport GraphQLRestRouter from 'graphql-rest-router';\nconst clientSchema = fs.readFileSync('./clientSchema.gql', 'utf-8');\n\nconst options = {\n  defaultCacheTimeInMS: 10\n};\n\nconst api = new GraphQLRestRouter('http://graphqlurl.com', clientSchema, options);\n\napi.mount('SearchUsers').at('/users');\napi.mount('GetUserById').at('/users/:id');\napi.mount('CreateUser').at('/users').as('post').withOption('cacheTimeInMs', 0);\n\napi.listen(3000, () =\u003e {\n  console.log('GraphQL Rest Router is listening!');\n});\n```\n\n## Table of Contents\n\n- [Overview / Introduction](#overview)\n  - [Internal GraphQL Usage](#internal-graphql-api)\n  - [External GraphQL Usage](#external-graphql-api)\n- [Documentation](#documentation)\n  - [Getting Started (Recommended)](#getting-started)\n  - [Creating Endpoints (Recommended)](#creating-endpoints)\n  - [Proxies / Authentication](#proxies-and-authentication)\n  - [Advanced Options](#advanced-configuration-of-graphql-rest-router)\n  - [Caching / Redis](#caching)\n  - [Swagger / OpenAPI / Documentation](#swagger--open-api)\n  - [Express.js Usage](#usage-with-express)\n  - [KOA Usage](#usage-with-koa)\n  - [Examples](#code-examples)\n- [Upgrading From Alpha](#upgrading-from-alpha)\n\n## Overview\n\nGraphQL 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.\n\n### Internal GraphQL API\n\nWhile 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).\n\nGraphQL Rest Router attempts to solve these problems by allowing you to leverage GraphQL upstream for all of your data resolution, but exposes predefined queries downstream to the public in the form of cacheable RESTful urls.\n\nInstead of exposing your server by having your client or web application (e.g. React, Angular, etc...) perform api calls directly to `http://yourgraphqlserver.com/?query={ getUserById(1) { firstName, lastName }` that could then be altered to `http://yourgraphqlserver.com/?query={ getUserById(1) { firstName, lastName, socialSecurityNumber }`, GraphQL Rest Router allows you to predefine a query and expose it as a restful route, such as `http://yourserver/api/users/1`. This ensures end users are only able to execute safe, performant, and tested queries.\n\n```js\nimport GraphQLRestRouter from 'graphql-rest-router';\nconst schema = `\n  query GetUserById($id: ID!) {\n    getUserById(1) {\n      firstName\n      lastName\n    }\n  }\n  \n  query SearchUsers($page: Int) {\n    search(page: $page) {\n      id\n      firstName\n      lastName\n    }\n  }\n`;\n\nconst api = new GraphQLRestRouter('http://yourgraphqlserver.com', schema);\n\napi.mount('GetUserById').at('/users/:id');\napi.mount('SearchUsers').at('/users').withOption('cacheTimeInMs', 0);\n\napi.listen(3000);\n```\n\nSee [Usage with Express](#usage-with-express) and read [Getting Started](#getting-started) to see all available options.\n\n### External GraphQL API\n\nWhen dealing with a publicly exposed GraphQL server that implements users and priveleges, the main benefit GraphQL Rest Router 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 Router's 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).\n\nOne line of GraphQL Rest Router code allows you to take\n\n```gql\nquery UserById($id: ID!) {\n  getUserById(id: $id) {\n    id\n    email\n    firstName\n    lastName\n  }\n}\n```\n\nand expose it as `http://www.youapiurl.com/user/:id` with a single line of code:\n\n```js\napi.mount('UserById').at('/user/:id');\n```\n\n## Documentation\n\nGraphQL Rest Router is available via NPM as `graphql-rest-router` (`npm install graphql-rest-router`)\n\n### Getting Started\n\nGet started by installing GraphQL Rest Router as a production dependency in your application with: `npm install --save graphql-rest-router`.\n\nTo instantiate a bare bones GraphQL Rest Router instance you'll need both the location of your GraphQL Server and the client schema you'll be using. It is advised that you create one `.gql` file per application that holds all of the application's respective queries.\n\nGraphQL Rest Router leverages [Operation Names](https://graphql.org/learn/queries/#operation-name) and [Variables](https://graphql.org/learn/queries/#variables) as a way to transform your provided schema into a REST endpoint. **Make sure that your queries and mutations are all utilizing operation names or they will not be mountable.**\n\nFor Example:\n\n```gql\n# THIS\nquery GetFirstUser {\n  getUser(id: 1) {\n    id\n    firstName\n    lastName\n  }\n}\n\n# NOT THIS\n{\n  getUser(id: 1) {\n    id\n    firstName\n    lastName\n  }\n}\n\n# THIS\nquery GetUser($id: ID!) {\n  getUser(id: $id) {\n    id\n    firstName\n    lastName\n  }\n}\n```\n\nOnce you have your schema and your endpoint, usage is straight-forward:\n\n```js\nimport GraphQLRestRouter from 'graphql-rest-router';\n\nconst schema = fs.readFileSync(`${__dirname}/schema.gql`, 'utf-8');\nconst endpoint = 'http://mygraphqlserver.com:9000';\n\nconst api = new GraphQLRestRouter(endpoint, schema);\n\napi.mount('GetFirstUser').at('/users/first');\napi.mount('GetUser').at('/users/:id');\n\napi.listen(3000);\n```\n\n### Creating Endpoints\n\nOnce GraphQL Rest Router has been configured, setting up endpoints to proxy queries is simple. Make sure that the schema you've provided is utilizing [Operation Names](https://graphql.org/learn/queries/#operation-name) and `mount(OperationName)` to have GraphQL Rest Router automatically scan your schema for the desired operation and create a RESTful endpoint for it. If you attempt to mount a non-named query or a query that does not exist within your provided schema, GraphQL Rest Router will throw an exception.\n\n```js\nconst api = new GraphQLRestRouter(endpoint, schema);\n\napi.mount('OperationName'); // Mounts \"query OperationName\" as \"GET /OperationName\"\n```\n\n#### HTTP Methods\n\nBy default, mounted queries are GET requests. If you'd like to change that you may specify any HTTP method using `.as()` on a route.\n\nExample:\n\n```js\nconst api = new GraphQLRestRouter(endpoint, schema);\n\napi.mount('GetUserById');           // GET /GetUserById\napi.mount('UpdateUser').as('put');  // PUT /UpdateUser\napi.mount('CreateUser').as('post'); // POST /CreateUser\n```\n\n#### Variables\n\nGraphQL Rest Router will read your provided schema to determine which variables are required and optional. If you are unsure how to create a named operation with variables, the [official GraphQL documentation](https://graphql.org/learn/queries/#variables) has examples. When mounted as a GET endpoint, the variables will be expected as query parameters, while all other methods will check the body for the required variables.\n\nIn order to reduce unnecessary load on the GraphQL server, GraphQL Rest Router validates the variables you've provided before sending a request to the GraphQL server.\n\nExample Schema:\n\n```gql\n# If GetUserById is mounted:\n#\n# - A GET request to /GetUserById will require you to pass in a query parameter of id or it will error.\n#\n#   Example:\n#     URL: /GetUserById?id=1\n#     Method: GET\n#\n# - A POST request to /GetUserByID will require you to pass in a body that conatins a JSON object with the key id.\n#\n#   Example:\n#     Url: /GetUserById\n#     Method: POST\n#     Headers: { Content-Type: application/json }\n#     Body: { \"id\": 1 }\n#\nquery GetUserById($id: Int!) {\n  getUserById(id: $id) {\n    firstName\n    lastName\n  }\n}\n\n# If SearchUsers is mounted:\n#\n# - A GET request to /SearchUsers will require you to pass in a query parameter of searchTerm or it will error. Optionally you #   may pass in page and resultsPerPage as well (/SearchUsers?searchTerm=pesto\u0026page=1\u0026resultsPerPage=10)\n#\n#   Example:\n#     URL: /SearchUsers?id=1\n#     Method: GET\n#\n# - A POST request to /SearchUsers will require you to pass in a body that conatins a JSON object with the key searchTerm and #   the optional parameters of page and resultsPerPage.\n#\n#   Example:\n#     Url: /GetUserById\n#     Method: POST\n#     Headers: { Content-Type: application/json }\n#     Body: { \"searchTerm\": \"pesto\", page: 1 }\n#\nquery SearchUsers($page: Int = 1, $resultsPerPage: Int, $searchTerm: String!) {\n  searchUsers(resultsPerPage: $resultsPerPage, page: $page, query: $searchTerm) {\n    email\n    firstName\n    lastName\n  }\n}\n`;\n```\n\n#### Custom Paths\n\nIf no path is provided to a mounted route, it will be made available exactly as it is typed in the operation name:\n\n```js\napi.mount('GetUserById'); // Made available at /GetUserById\n```\n\nIt is possible to change/customize this mounting path by using `.at(pathname)` on a route.\n\n```js\napi.mount('GetUserById').at('/user'); // A call to '/user?id=42' will execute a 'GetUserById' operation on your GraphQL Server with an id of 42\n```\n\nIt is also possible to describe a required variable in the path using a syntax similar to that of express routes\n\n```js\napi.mount('GetUserById').at('/user/:id'); // A call to /user/42 will execute a 'GetUserById'operation on your GraphQL server with an id of 42\n```\n\n#### Schemaless Mount\n\nA schema is optional with GraphQL Rest Router. You may inline a query on call to `mount()` instead.\n\nExample:\n\n```js\nconst api = new GraphQLRestRouter(endpoint);\n\n// Simple inline query\napi.mount('{ users { displayName } }').at('/usernames'); // GET /usernames\n\n// With a path parameter\napi.mount('query GetUserByID($id: ID!) { displayName }').at('/user/:id'); // GET /user/:id\n```\n\n### Proxies and Authentication\n\nIf the server that you are running GraphQL Rest Router on requires a proxy to connect to the GraphQL server or credentials to connect, you may pass them directly into GraphQL Rest Router during instantiation or on a per route basis to limit them to specific routes. See [Advanced Configuration of GraphQL Rest Router](#Advanced-Configuration-of-GraphQL-Rest-Router) for implementation\n\n### Advanced Configuration of GraphQL Rest Router\n\nGraphQL Rest Router takes an optional third parameter during initialization that allows you to control default cache, headers, authentication and proxies.\n\n```js\nconst options = {\n  defaultCacheTimeInMs: 3000,\n};\n\nnew GraphQLRestRouter(endpoint, schema, options);\n```\n\nA list of options and their default values is below:\n\n| Property | Type | Default | Description |\n| --- | --- | --- | --- |\n| 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 |\n| defaultTimeoutInMs | number | 10000 | The amount of time to allow for a request to the GraphQL to wait before timing out an endpoint |\n| cacheKeyIncludedHeaders | string[] | [] | HTTP Headers that are used in the creation of the cache key for requests. This allows users to identify unique requests by specific headers. If these headers specified here differ between requests, they will be considered unique requests. |\n| optimizeQueryRequest | boolean | false | When set to true, GraphQL 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|\n| 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) |\n| passThroughHeaders | 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']) |\n| auth | [AxiosBasicCredentials](https://github.com/axios/axios/blob/76f09afc03fbcf392d31ce88448246bcd4f91f8c/index.d.ts#L9-L12) | null | If the GraphQL server is protected with basic auth provide the basic auth credentials here to allow GraphQL Rest Router to connect. (Example: { username: 'pesto', password: 'foobar' } |\n| proxy | [AxiosProxyConfig](https://github.com/axios/axios/blob/76f09afc03fbcf392d31ce88448246bcd4f91f8c/index.d.ts#L14-L22) | null | If a proxy is required to communicate with your GraphQL server from the server that GraphQL Rest Router is running on, provide it here. |\n| cacheEngine | [ICacheEngine](https://github.com/Econify/graphql-rest-router/blob/29cc328f23b8dd579a6f4af242266460e95e7d69/src/types.ts#L87-L90) | null | Either a cache engine that [ships default](#Caching) with GraphQL Rest Router or adheres to the [ICacheEngine interface](#Custom-Cache-Engine) |\n| logger | [ILogger](https://github.com/Econify/graphql-rest-router/blob/29cc328f23b8dd579a6f4af242266460e95e7d69/src/types.ts#L101-L107) | null | A logger object that implements info, warn, error, and debug methods |\n| defaultLogLevel | number | 0 | Default logger level for the logger object |\n\nRoutes can be individually configured using the `withOptions` or `withOption` methods. See more usage examples below.\n\n```js\nimport GraphQLRestRouter, { LogLevels, InMemoryCache } from 'graphql-rest-router';\n\nconst api = new GraphQLRestRouter('http://localhost:1227', schema);\n\n// Set individual option\napi.mount('CreateUser').withOption('cacheEngine', new InMemoryCache());\n\n// Set two options with one function call\napi.mount('GetUser').withOptions({\n  logger: console,\n  logLevel: LogLevels.DEBUG,\n});\n```\n\n### Request \u0026 Response Transformations\n\nGraphQL Rest Router allows the developer to add transformations on incoming requests or outgoing responses. By default, the regular axios transformers are used.\n\nIf the shape of data coming from GraphQL is not what your consuming application needs, transformation logic can be encapsulated inside of the REST layer in the form of these callbacks.\n\n```js\nimport GraphQLRestRouter from 'graphql-rest-router';\n\nconst api = new GraphQLRestRouter('http://localhost:1227', schema);\n\napi.mount('GetImages').withOption('transformResponse', (response) =\u003e {\n  const { data, errors } = response;\n\n  return {\n    data: {\n      // Turn images array into image URL map\n      images: data.images?.reduce((acc, img) =\u003e {\n        acc[img.url] = img;\n      }, {}),\n    }\n    errors,\n  };\n}));\n```\n\nYou can also modify the outgoing request. These transformers should return the stringified request, but also allow you to modify the request headers.\n\n```js\nimport GraphQLRestRouter from 'graphql-rest-router';\n\nconst api = new GraphQLRestRouter('http://localhost:1227', schema);\n\napi.mount('GetImages').at('/images').withOption('transformRequest', (request, headers) =\u003e {\n  headers['X-My-Header'] = 'MyValue';\n  return request;\n});\n```\n\n### Logging\n\nGraphQL Rest Router supports robust logging of incoming requests and errors. On instantiation, a logger of your choice can be injected with configurable log levels. The logger object must implement [ILogger](https://github.com/Econify/graphql-rest-router/blob/29cc328f23b8dd579a6f4af242266460e95e7d69/src/types.ts#L101-L107), and log levels must be one of the following [ILogLevels](https://github.com/Econify/graphql-rest-router/blob/f83881d30bdb329a306ebb94fdf577fb065f2e6e/src/types.ts#L107-L113).\n\n```js\nimport GraphQLRestRouter, { LogLevels } from 'graphql-rest-router';\n\nconst api = new GraphQLRestRouter('http://localhost:1227', schema, {\n  logger: console,\n  defaultLogLevel: LogLevels.ERROR // Log only errors\n});\n\napi.mount('CreateUser').withOption('logLevel', LogLevels.DEBUG); // Log everything\napi.mount('GetUser').withOption('logLevel', LogLevels.SILENCE); // No logs\n```\n\n### Caching\n\nGraphQL Rest Router includes two cache interfaces and supports any number of custom or third party caching interfaces, as long as they implement [ICacheEngine](https://github.com/Econify/graphql-rest-router/blob/29cc328f23b8dd579a6f4af242266460e95e7d69/src/types.ts#L87-L90)\n\n*Important note about cache key creation*: by default, GraphQL Rest Router does not differentiate cache keys based on their HTTP headers. If an upstream GraphQL service returns different responses based on headers, the GraphQL rest router instance would be required to include them in the `cacheKeyIncludedHeaders` global configuration option.\n\nFor example, if your application supports `Authorization` headers, you must include that header in the `cacheKeyIncludedHeaders` field. The cache layer will then not serve User A's result to User B. Alternatively, you can disable the cache on authorized routes.\n\n#### In Memory Cache\n\nInMemoryCache stores your cached response data on your server in memory. This can be used in development or with very low throughput, however it is strongly discouraged to use this in production.\n\n```js\nimport GraphQLRestRouter, { InMemoryCache } from 'graphql-rest-router';\n\nconst api = new GraphQLRestRouter('http://localhost:1227', schema, {\n  cacheEngine: new InMemoryCache(),\n  defaultCacheTimeInMs: 300,\n});\n \napi.mount('CreateUser').withOption('cacheTimeInMs', 0); // Disable the cache on this route\n```\n\nNote: By default the InMemoryCache TTL is 10 milliseconds. This is configurable via the constructor. E.g. `new InMemoryCache(5000)` will expire entries every 5 seconds instead of every 10 milliseconds.\n\n#### Redis Cache\n\nRedisCache stores your cached route data in an external Redis instance. The RedisCache class constructor accepts the [ClientOpts](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f4b63e02370940350887eaa82ac976dc2ecbf313/types/redis/index.d.ts#L39) object type provided for connection configuration.\n\n```js\nimport GraphQLRestRouter, { RedisCache } from 'graphql-rest-router';\n\nconst api = new GraphQLRestRouter('http://localhost:1227', schema, {\n  cacheEngine: new RedisCache({ host: 'localhost', port: 6379 }),\n  defaultCacheTimeInMs: 300000, // 5 minutes\n});\n\napi.mount('CreateUser').withOption('cacheTimeInMs', 0); // Disable the cache on this route\napi.mount('GetUser').withOption('cacheTimeInMs', 500); // Override 5 minute cache\n```\n\n#### Custom Cache Engine\n\nYou may implement a custom cache engine as long as it adheres to the [ICacheEngine](https://github.com/Econify/graphql-rest-router/blob/af05660d53ee74df10ccc85c9fdc958eec09ff71/src/types.ts#L94-L97) interface.\n\nSimply said, provide an object that contains `get` and `set` functions. See `InMemoryCache.ts` or `RedisCache.ts` as examples.\n\n```js\nimport GraphQLRestRouter from 'graphql-rest-router';\nimport CustomCache from ...;\n\nconst api = new GraphQLRestRouter('http://localhost:1227', schema, {\n  cacheEngine: new CustomCache(),\n  defaultCacheTimeInMs: 300,\n});\n \napi.mount('CreateUser');\n```\n\n### Swagger / Open API\n\nAs 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.\n\n#### Open API (Preferred)\n\n```js\nconst { OpenApi } = require('graphql-rest-router');\n\nconst documentation = new OpenApi.V3({\n  title: 'My REST API', // REQUIRED!\n  version: '1.0.0',     // REQUIRED!\n\n  host: 'http://localhost:1227',\n  basePath: '/api',\n});\n\nconst api = new GraphQLRestRouter('http://yourgraphqlendpoint', schema);\n\napi.mount(documentation).at('/docs/openapi');\n```\n\n#### Swagger\n\n```js\nconst { OpenApi } = require('graphql-rest-router');\n\nconst swaggerDocumentation = new OpenApi.V2({\n  title: 'My REST API', // REQUIRED!\n  version: '1.0.0',     // REQUIRED!\n  \n  host: 'http://localhost:1227',\n  basePath: '/api',\n});\n\nconst api = new GraphQLRestRouter('http://yourgraphqlendpoint', schema);\n\napi.mount(swaggerDocumentation).at('/docs/swagger');\n```\n\n#### API Blueprint\n\nNot supported yet, please create a PR!\n\n### Usage with Web Frameworks\n\nCurrently GraphQL Rest Router only supports Express out of the box. Please submit a PR or an Issue if you would like to see GraphQL Rest Router support additional frameworks.\n\n#### Usage with Express\n\nIt is common to leverage GraphQL Rest Router client on a server that is already delivering a website as opposed to standing up a new server. To integrate with an existing express server, simply export GraphQL Rest Router as express using `.asExpressRouter()` instead of starting up a new server using `.listen(port)`.\n\nFor Example:\n\n```js\n// api.js\nconst api = new GraphQLRestRouter(endpoint, schema);\n\napi.mount('GetUserById').at('/users/:id');\n\nexport default api.asExpressRouter();\n\n// server.js\nimport express from 'express';\nimport api from './api';\n\nconst app = express();\n\napp.get('/status', (req, res) =\u003e ...);\napp.get('/', (req, res) =\u003e ...);\napp.use('/api', api); // Mounts GraphQL Rest Router ON :3000/api/* (e.g. :3000/api/users/4)\n\napp.listen(3000);\n```\n\n#### Usage with KOA\n\nAs of the time of this writing, a KOA extension for GraphQL Rest Router is not available. Feel free to submit a PR.\n\n### Code Examples\n\nSee the [example client](/example-consuming-client) in this repo for code examples.\n\n## Upgrading from Alpha\n\nThere is one breaking change with the release of `1.0.0-beta.0`: Transform response callbacks now receive parsed data as opposed to the stringified version. Therefore, any callback passed in this way must no longer parse prior to processing.\n\nChained route methods such as `disableCache()` or `transformResponse()` have been deprecated. Please use `withOption()` or `withOptions()` instead. Support for chained route methods will be removed in a future version.\n\nFor example:\n\n```js\n// not this\napi.mount('GetUserById').at('/users/:id').disableCache().transformResponse(cb);\n\n// this\napi.mount('GetUserById').at('/users/:id').withOptions({\n  cacheTimeInMs: 0,\n  transformResponse: cb,\n});\n```\n\n## Like this package?\n\nCheck out Econify's other GraphQL package, [graphql-request-profiler](https://www.github.com/Econify/graphql-request-profiler), an easy to use performance analysis and visualization tool for tracing API resolver execution time.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEconify%2Fgraphql-rest-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEconify%2Fgraphql-rest-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEconify%2Fgraphql-rest-router/lists"}