{"id":18407588,"url":"https://github.com/clumsyme/graphql-demo","last_synced_at":"2025-09-11T23:37:33.735Z","repository":{"id":98890087,"uuid":"162546330","full_name":"clumsyme/graphql-demo","owner":"clumsyme","description":"demos using graphql","archived":false,"fork":false,"pushed_at":"2018-12-20T09:11:02.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-04T12:33:04.667Z","etag":null,"topics":["demo","graphql","graphql-js"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/clumsyme.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"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-20T08:01:41.000Z","updated_at":"2018-12-20T09:11:03.000Z","dependencies_parsed_at":"2023-03-07T19:45:15.369Z","dependency_job_id":null,"html_url":"https://github.com/clumsyme/graphql-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/clumsyme/graphql-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fgraphql-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fgraphql-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fgraphql-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fgraphql-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clumsyme","download_url":"https://codeload.github.com/clumsyme/graphql-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fgraphql-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274726844,"owners_count":25338396,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-js"],"created_at":"2024-11-06T03:14:35.000Z","updated_at":"2025-09-11T23:37:33.686Z","avatar_url":"https://github.com/clumsyme.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `graphql` with [graphql-js](https://github.com/graphql/graphql-js/)\n\n## two versions of a blog system implemention\n\n```graphql\ntype Article {\n    id: ID!\n    title: String\n    content: String\n    tags: [Tag]\n    comments(keyword: String): [Comment]\n}\ntype Tag {\n    id: ID!\n    name: String\n    articles(keyword: String): [Article]\n}\ntype Comment {\n    id: ID!\n    author: String\n    content: String\n}\ntype Query {\n    articles(title: String): [Article]\n    tags(first: Int): [Tag]\n}\n```\n\n## usage\n\n```bash\nnpm install\nnpm start\n```\n\nthen\n\n-   visit: http://127.0.0.1:8080 for the `buildSchema` version\n-   visit: http://127.0.0.1:8088 for the `GraphQLObjectType` version\n\ngive the following `query`\n\n```graphql\nquery myBlog($articleTitle: String, $show: Boolean!, $first: Int) {\n    articles(title: $articleTitle) {\n        title\n        tags {\n            name\n        }\n        comments {\n            ...comments\n        }\n    }\n    tags(first: $first) {\n        name\n        articleList: articles @include(if: $show) {\n            title\n            comments {\n                ...comments\n            }\n        }\n    }\n}\n\nfragment comments on Comment {\n    author\n    content\n}\n```\n\nand the following `query variables`\n\n```json\n{\n    \"articleTitle\": \"React\",\n    \"show\": true,\n    \"first\": 2\n}\n```\n\nwe will get\n\n```json\n{\n    \"data\": {\n        \"articles\": [\n            {\n                \"title\": \"React Hooks Intro\",\n                \"tags\": [\n                    {\n                        \"name\": \"Program\"\n                    },\n                    {\n                        \"name\": \"Development\"\n                    }\n                ],\n                \"comments\": [\n                    {\n                        \"author\": \"Frodo\",\n                        \"content\": \"That' awesome, make react dev easier.\"\n                    },\n                    {\n                        \"author\": \"Bilbo\",\n                        \"content\": \"I like it.\"\n                    }\n                ]\n            }\n        ],\n        \"tags\": [\n            {\n                \"name\": \"Program\",\n                \"articleList\": [\n                    {\n                        \"title\": \"Learn Web Dev\",\n                        \"comments\": [\n                            {\n                                \"author\": \"Yan\",\n                                \"content\": \"Great Article\"\n                            }\n                        ]\n                    },\n                    {\n                        \"title\": \"React Hooks Intro\",\n                        \"comments\": [\n                            {\n                                \"author\": \"Frodo\",\n                                \"content\": \"That' awesome, make react dev easier.\"\n                            },\n                            {\n                                \"author\": \"Bilbo\",\n                                \"content\": \"I like it.\"\n                            }\n                        ]\n                    }\n                ]\n            },\n            {\n                \"name\": \"Life\",\n                \"articleList\": [\n                    {\n                        \"title\": \"Happy Day\",\n                        \"comments\": [\n                            {\n                                \"author\": \"Luke\",\n                                \"content\": \"That's Great\"\n                            },\n                            {\n                                \"author\": \"Leia\",\n                                \"content\": \"So Funny~ I like it.\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        ]\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclumsyme%2Fgraphql-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclumsyme%2Fgraphql-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclumsyme%2Fgraphql-demo/lists"}