{"_id":"body-parser-graphql","_rev":"2-eab9a8b3cb3d8cdcd0cf5a9a4cbfa752","name":"body-parser-graphql","description":"GraphQL server middleware to support application/graphql requests","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"body-parser-graphql","version":"1.0.0","description":"GraphQL server middleware to support application/graphql requests","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"prepublish":"npm run build","build":"rm -rf dist && tsc -d","test":"nyc cucumber-js --compiler ts:ts-node/register test/features/ -r test/step_definitions/ -f json:test/report/cucumber_report.json","posttest":"node test/createReport.js && nyc report --reporter=text-lcov | coveralls","vscodetest":"nyc --reporter=lcov --reporter=text-summary cucumber-js --compiler ts:ts-node/register test/features/ -r test/step_definitions/ -f ./test/tap-formatter.js","semantic-release":"semantic-release"},"keywords":["graphql","express"],"author":{"name":"Kim Brandwijk","email":"kim.brandwijk@gmail.com"},"license":"MIT","nyc":{"extension":[".ts"],"require":["ts-node/register"],"include":["src/**/*.ts"],"exclude":["**/*.d.ts"],"reporter":["text","lcov","json"],"all":true,"sourceMap":true,"instrument":true},"dependencies":{"body-parser":"^1.18.2"},"devDependencies":{"@types/chai":"4.0.10","@types/chai-http":"3.0.3","@types/cucumber":"3.1.1","@types/express":"4.11.0","@types/node":"8.5.2","chai":"4.1.2","chai-http":"3.0.0","condition-circle":"2.0.1","coveralls":"3.0.0","cucumber":"3.2.0","cucumber-html-reporter":"3.0.4","express":"4.16.2","nyc":"11.4.1","semantic-release":"12.0.0","ts-node":"4.1.0","typescript":"2.6.2"},"repository":{"type":"git","url":"git+https://github.com/supergraphql/body-parser-graphql.git"},"bugs":{"url":"https://github.com/supergraphql/body-parser-graphql/issues"},"homepage":"https://github.com/supergraphql/body-parser-graphql#readme","release":{"branch":"master","verifyConditions":"condition-circle"},"gitHead":"0ba47bd51c5936a2625ac137b0a0ab3d26127015","_id":"body-parser-graphql@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"9.3.0","_npmUser":{"name":"kbrandwijk","email":"kim.brandwijk@gmail.com"},"dist":{"integrity":"sha512-q5YuYlNwnGf9bdHUK5KA4jU1pRp7zqspsOZHN26NcAPa4CS8NaFnCWPsyx+uvJGBaOA087eRLYn912/2oYmfhA==","shasum":"997de1792ed222cbc4845d404f4549eb88ec6d37","tarball":"https://registry.npmjs.org/body-parser-graphql/-/body-parser-graphql-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCEkdfi2j2C/v8K/xu7nn5JC16CX7qPPZmq1m8Jjy9eygIhAMrdkN5GC9sRyJktoJ8HYrDuadGD8nGYluF9Z2Lj6hPm"}]},"maintainers":[{"name":"kbrandwijk","email":"kim.brandwijk@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/body-parser-graphql-1.0.0.tgz_1514800636519_0.927813493879512"},"directories":{}},"1.1.0":{"name":"body-parser-graphql","version":"1.1.0","description":"GraphQL server middleware to support application/graphql requests","main":"dist/index.js","typings":"dist/index.d.ts","scripts":{"prepublish":"npm run build","build":"rm -rf dist && tsc -d","test":"nyc cucumber-js --compiler ts:ts-node/register test/features/ -r test/step_definitions/ -f json:test/report/cucumber_report.json","posttest":"node test/createReport.js && nyc report --reporter=text-lcov | coveralls","vscodetest":"nyc --reporter=lcov --reporter=text-summary cucumber-js --compiler ts:ts-node/register test/features/ -r test/step_definitions/ -f ./test/tap-formatter.js","semantic-release":"semantic-release"},"keywords":["graphql","express"],"author":{"name":"Kim Brandwijk","email":"kim.brandwijk@gmail.com"},"license":"MIT","nyc":{"extension":[".ts"],"require":["ts-node/register"],"include":["src/**/*.ts"],"exclude":["**/*.d.ts"],"reporter":["text","lcov","json"],"all":true,"sourceMap":true,"instrument":true},"dependencies":{"body-parser":"^1.18.2"},"devDependencies":{"@types/chai":"4.1.2","@types/chai-http":"3.0.4","@types/cucumber":"3.2.2","@types/express":"4.11.1","@types/node":"9.4.6","chai":"4.1.2","chai-http":"3.0.0","coveralls":"3.0.0","cucumber":"3.2.1","cucumber-html-reporter":"4.0.1","express":"4.16.2","nyc":"11.4.1","semantic-release":"12.4.1","ts-node":"5.0.0","typescript":"2.7.2"},"repository":{"type":"git","url":"git+https://github.com/supergraphql/body-parser-graphql.git"},"bugs":{"url":"https://github.com/supergraphql/body-parser-graphql/issues"},"homepage":"https://github.com/supergraphql/body-parser-graphql#readme","release":{"branch":"master"},"gitHead":"41f5abbd223cfdb6f0a500b5d7fa38f34935a7e5","_id":"body-parser-graphql@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"kbrandwijk","email":"kim.brandwijk@gmail.com"},"dist":{"integrity":"sha512-bOBF4n1AnUjcY1SzLeibeIx4XOuYqEkjn/Lm4yKhnN6KedoXMv4hVqgcKHGRnxOMJP64tErqrQU+4cihhpbJXg==","shasum":"80a80353c7cb623562fd375750dfe018d75f0f7c","tarball":"https://registry.npmjs.org/body-parser-graphql/-/body-parser-graphql-1.1.0.tgz","fileCount":20,"unpackedSize":161384,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4d4uCRA9TVsSAnZWagAAXfwQAJbbDIEfJ4vOfIt4CCB7\nMIfPrtuWX76PsmnDyQX6GRUlqQTbU2/T7sAZrmk1vG4xDG5d8p0jcY1yKzEE\nzDf6y+DW0wCyBfG6bc2xdZA8b+hl4R8UYQY7OqCuNg+95BbxZFSJOPqY5qkJ\nWuB15/U7Ax0zS1y8VuqSYhuHKOK51XTn1Fgpg8Po3tNSWgzJzSsuWHTfAOsy\nTpbvCII8Yzo/8tWqERJfQ06AWUrmQv7IJ6TwRjlHTGIN4dUhatwo8n3mab5y\n7aGM60gLlu6SE5hVrf30MWgT9xoF6e7cWR5ChP180nkT/foxzaRN9ycV64qu\noUd6/ATvDW/chUzvFGm4LWlBd0bmCU7tb4DrV7k/u2aatDL7Bpr/IbtwCIRd\noo0Xrl/JsZz2wUZH0tsBnVRU5cmXPaXI2BNZ7m+PTzJ3YpUaPyd87N6E/58k\nAqDfJ1kZJwK4+XpS2+/9rvJV7bkRFgdIBvPJQ/VWM3nk65XHyDjVFimbFJJm\nBJ3vNPxdMp4CqZ7WgUpyN6BHKGY1wr7di70g6Pm9wy+ptRRytO0/bfY03GM8\ngeVYhD0Uf8C02vyvdrrlLCOn9AYoYykVSPyHG2wPAX7vP2Jrdk7mBkkX0Sz7\n6tsfvDerlrdWDc2wWQncx3Sx6n5R+3XeegcNkAOsGu6WovBz1uqAkKgqV2qT\nUZe9\r\n=bw28\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEjFxaR2tZv3eFgkWR/yPKIUu5hLcYHAcSGGnFyRhAAWAiAHya2K772dXCnkzyFZY7EI25abidMgxTFmnZ955e/Gxg=="}]},"maintainers":[{"name":"kbrandwijk","email":"kim.brandwijk@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/body-parser-graphql_1.1.0_1524751917191_0.9861149874355337"},"_hasShrinkwrap":false}},"readme":"# body-parser-graphql [![npm](https://img.shields.io/npm/v/body-parser-graphql.svg?style=for-the-badge)](https://www.npmjs.com/package/body-parser-graphql)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge)](https://github.com/semantic-release/semantic-release)[![CircleCI](https://img.shields.io/circleci/project/github/supergraphql/body-parser-graphql.svg?style=for-the-badge)](https://circleci.com/gh/supergraphql/body-parser-graphql)[![Code Climate](https://img.shields.io/codeclimate/maintainability/supergraphql/body-parser-graphql.svg?style=for-the-badge&label=code%20quality)](https://codeclimate.com/github/supergraphql/body-parser-graphql)[![Coveralls](https://img.shields.io/coveralls/github/supergraphql/body-parser-graphql.svg?style=for-the-badge)](https://coveralls.io/github/supergraphql/body-parser-graphql)[![Renovate badge](https://img.shields.io/badge/renovate-enabled-e10079.svg?style=for-the-badge)](https://renovateapp.com/)  \nExpress body-parser that supports the `application/graphql` MIME type.\n\n## How does it work?\n`body-parser-graphql` checks the `Content-Type` header of the request. If the Content-Type is `application/graphql`, the request is transformed into a 'normal' `application/json` GraphQL request, and the `Content-Type` header is set to `application/json`.\n\nReceived request:\n```graphql\n{\n  posts {\n    id\n    title\n  }\n}\n```\n`request.body` value after the middleware:\n```js\n{\n  query: {\n    posts {\n      id\n      title\n    }\n  }\n}\n```\n\nIf an `application/json` request is received, it applies the JSON body-parser.\n\n## Installation\n\nInstall `body-parser-graphql` using your favorite package manager:\n```shell\n$ yarn add body-parser-graphql\n$ npm install body-parser-graphql\n```\n\n## Usage\n\nThe `body-parser-graphql` can be used as a drop-in replacement for the normal `json` body-parser.\n\n```diff\nimport * as express from 'express'\n- import * as bodyParser from 'body-parser'\n+ import * as bodyParser from 'body-parser-graphql'\n\nconst app = express()\n\n- app.use(bodyParser.json())\n+ app.use(bodyParser.graphql())\n\n// Your express routes\n\napp.listen(/* your configuration */)\n```\n\nAlternatively, you can also import the body-parser directly:\n\n```typescript\nimport { bodyParserGraphQL } from 'body-parser-graphql'\n\napp.use(bodyParserGraphQL())\n```\n\n<hr>\n<p align=\"center\">\n  <img src=\"https://img.shields.io/badge/built-with_%F0%9F%92%99-blue.svg?style=for-the-badge\"/><a href=\"https://github.com/kbrandwijk\" target=\"-_blank\"><img src=\"https://img.shields.io/badge/by-kim_brandwijk-blue.svg?style=for-the-badge\"/></a>\n</p>\n","maintainers":[{"name":"kbrandwijk","email":"kim.brandwijk@gmail.com"}],"time":{"modified":"2022-04-12T03:53:01.731Z","created":"2018-01-01T09:57:16.626Z","1.0.0":"2018-01-01T09:57:16.626Z","1.1.0":"2018-04-26T14:11:57.292Z"},"homepage":"https://github.com/supergraphql/body-parser-graphql#readme","keywords":["graphql","express"],"repository":{"type":"git","url":"git+https://github.com/supergraphql/body-parser-graphql.git"},"author":{"name":"Kim Brandwijk","email":"kim.brandwijk@gmail.com"},"bugs":{"url":"https://github.com/supergraphql/body-parser-graphql/issues"},"license":"MIT","readmeFilename":"README.md"}