{"id":13431552,"url":"https://github.com/LanceGin/GraphQL-Server-Demo","last_synced_at":"2025-03-16T11:31:58.172Z","repository":{"id":106471594,"uuid":"141282144","full_name":"LanceGin/GraphQL-Server-Demo","owner":"LanceGin","description":"GraphQL server demo with nodejs","archived":false,"fork":false,"pushed_at":"2018-07-24T12:34:36.000Z","size":69,"stargazers_count":18,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-06T07:53:21.769Z","etag":null,"topics":["demo","graphql","graphql-demo","graphql-server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LanceGin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-07-17T11:47:46.000Z","updated_at":"2022-12-04T00:55:19.000Z","dependencies_parsed_at":"2024-01-16T01:25:40.142Z","dependency_job_id":null,"html_url":"https://github.com/LanceGin/GraphQL-Server-Demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanceGin%2FGraphQL-Server-Demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanceGin%2FGraphQL-Server-Demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanceGin%2FGraphQL-Server-Demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LanceGin%2FGraphQL-Server-Demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LanceGin","download_url":"https://codeload.github.com/LanceGin/GraphQL-Server-Demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243863319,"owners_count":20360298,"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":["demo","graphql","graphql-demo","graphql-server"],"created_at":"2024-07-31T02:01:04.015Z","updated_at":"2025-03-16T11:31:56.842Z","avatar_url":"https://github.com/LanceGin.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# GraphQL-Server-Demo\n\n[中文文档](https://github.com/LanceGin/GraphQL-Server-Demo/blob/master/README_zh.md)\n\n\u003e `GraphQL-Server-Demo` is a typical example of starting a GraphQL Server with node.js. It is an easy and readable project to learn and understand [GraphQL](https://graphql.org/).\n\n## Screenshots\n\n### Query\n\n![](http://orhcxc3kd.bkt.clouddn.com/query.png)\n\n### Mutation\n\n![](http://orhcxc3kd.bkt.clouddn.com/mutation.png)\n\n## Structure\n\n```\nGraphQL-Server-Demo\n├── README.md\n├── LICENSE\n├── .babelrc\n├── .gitignore\n├── package.json\n├── yarn.lock\n├── dev.sqlite\n├── app.js\n├── schemas\n│   └── index.js\n├── resolvers\n│   ├── userResolver.js\n│   ├── messageResolver.js\n│   └── ...\n└── types\n    ├── query.js\n    ├── mutation.js\n    ├── queries\n    │    ├── userType.js\n    │    ├── messageType.js\n    │    └── ... \n    └── mutations\n         ├── userInputType.js\n         ├── messageInputType.js\n         └── ... \n```\n\n* `app.js` -- server engine of this project\n* `dev.sqlite` -- test database\n* `schemas` -- basic schema to create the `GraphQLSchema`, contanins the basic `queryType` and `mutationType`\n* `types` -- all the `GraphQLObjectType` that user defined\n* `resolvers` -- all the resolvers to resolve the Type data\n\n## Quick Start\n\nExcute the commands below: \n\n```shell\ngit clone git@github.com:LanceGin/GraphQL-Server-Demo.git\ncd GraphQL-Server-Demo\nyarn \u0026\u0026 yarn start\n```\n\nOpen the url `http://localhost:4000/graphql`, you will see the `GraphiQL` GUI in the window, and you can excute the example query and mution operations.\n\n## Query Operation\n\n### Request\n\n```graphql\nquery {\n  user(id: 1) {\n    name\n    nickname\n    message {\n      id\n      content\n    }\n  }\n}\n```\n\n### Response\n\n```json\n{\n  \"data\": {\n    \"user\": [\n      {\n        \"name\": \"gin\",\n        \"nickname\": \"lancegin\",\n        \"message\": [\n          {\n            \"id\": \"1\",\n            \"content\": \"test message\"\n          },\n          {\n            \"id\": \"2\",\n            \"content\": \"hello\"\n          },\n          {\n            \"id\": \"3\",\n            \"content\": \"world\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n\n## Mutation Operation\n\n### Request\n\n```graphql\nmutation {\n  createMessage(input: {user_id: \"1\", content: \"hello world111\"}) {\n    id\n    content\n  }\n}\n```\n\n### Response\n\n```json\n{\n  \"data\": {\n    \"createMessage\": {\n      \"id\": \"10\",\n      \"content\": \"hello world111\"\n    }\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLanceGin%2FGraphQL-Server-Demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLanceGin%2FGraphQL-Server-Demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLanceGin%2FGraphQL-Server-Demo/lists"}