super-graph/jsn/test.json

1 line
61 KiB
JSON
Raw Permalink Normal View History

2020-02-23 21:29:50 +01:00
{"data":{"published":true,"body":"---\nsidebar: auto\n---\n# Guide to Super Graph\n\nSuper Graph is a service that instantly and without code gives you a high performance and secure GraphQL API. Your GraphQL queries are auto translated into a single fast SQL query. No more spending weeks or months writing backend API code. Just make the query you need and Super Graph will do the rest. \n\nSuper Graph has a rich feature set like integrating with your existing Ruby on Rails apps, joining your DB with data from remote APIs, Role and Attribute based access control, Support for JWT tokens, DB migrations, seeding and a lot more.\n\n\n## Features\n\n* Role and Attribute based access control\n* Works with existing Ruby\\-On\\-Rails apps\n* Automatically learns database schemas and relationships\n* Full text search and aggregations\n* Rails authentication supported \\(Redis, Memcache, Cookie\\)\n* JWT tokens supported \\(Auth0, etc\\)\n* Join database with remote REST APIs\n* Highly optimized and fast Postgres SQL queries\n* GraphQL queries and mutations\n* A simple config file\n* High performance GO codebase\n* Tiny docker image and low memory requirements\n* Fuzz tested for security\n* Database migrations tool\n* Database seeding tool\n\n\n## Try the demo app\n\n```bash\n# clone the repository\ngit clone https://github.com/dosco/super-graph\n\n# setup the demo rails app & database and run it\ndocker-compose run rails_app rake db:create db:migrate db:seed\n\n# run the demo\ndocker-compose up\n\n# signin to the demo app (user1@demo.com / 123456)\nopen http://localhost:3000\n\n# try the super graph web ui\nopen http://localhost:8080\n\n```\n\n::: tip DEMO REQUIREMENTS\nThis demo requires `docker` you can either install it using `brew` or from the\ndocker website [https://docs.docker.com/docker\\-for\\-mac/install/](https://docs.docker.com/docker-for-mac/install/)\n:::\n\n#### Trying out GraphQL\n\nWe fully support queries and mutations. For example the below GraphQL query would fetch two products that belong to the current user where the price is greater than 10.\n\n#### GQL Query\n\n```graphql\nquery {\n users {\n id\n email\n picture : avatar\n password\n full_name\n products(limit: 2, where: { price: { gt: 10 } }) {\n id\n name\n description\n price\n }\n }\n}\n\n```\n\n#### JSON Result\n\n```json\n{\n \"data\": {\n \"users\": [\n {\n \"id\": 1,\n \"email\": \"odilia@west.info\",\n \"picture\": \"https://robohash.org/simur.png?size=300x300\",\n \"full_name\": \"Edwin Orn\",\n \"products\": [\n {\n \"id\": 16,\n \"name\": \"Sierra Nevada Style Ale\",\n \"description\": \"Belgian Abbey, 92 IBU, 4.7%, 17.4°Blg\",\n \"price\": 16.47\n },\n ...\n ]\n }\n ]\n }\n}\n\n```\n\n::: tip Testing with a user\nIn development mode you can use the `X-User-ID: 4` header to set a user id so you don't have to worries about cookies etc. This can be set using the _HTTP Headers_ tab at the bottom of the web UI.\n:::\n\nIn another example the below GraphQL mutation would insert a product into the database. The first part of the below example is the variable data and the second half is the GraphQL mutation. For mutations data has to always ben passed as a variable.\n\n```json\n{\n \"data\": { \n \"name\": \"Art of Computer Programming\",\n \"description\": \"The Art of Computer Programming (TAOCP) is a comprehensive monograph written by computer scientist Donald Knuth\",\n \"price\": 30.5\n }\n}\n\n```\n\n```graphql\nmutation {\n product(insert: $data) {\n id\n name\n }\n}\n\n```\n\n## Why Super Graph\n\nLet's take a simple example say you want to fetch 5 products priced over 12 dollars along with the photos of the products and the users that owns them. Additionally also fetch the last 10 of your own purchases along with the name and ID of the product you purchased. This is a common type of query to render a view in say an ecommerce app. Lets be honest it's no