-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Conrad Reuter
committed
Jul 12, 2017
0 parents
commit 164fac7
Showing
23 changed files
with
3,313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"plugins": [ | ||
["inline-import", { "extensions": [".gql"] } ], | ||
"inline-json-import" | ||
], | ||
"presets": [ | ||
"es2015", | ||
"es2016" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
GraphQL example for the DresdenJS.io meetup group. | ||
|
||
Run `yarn run info` to list all available commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# An article that can be viewed and ordered. | ||
type Article { | ||
# A text describing the details of the article. | ||
description: String | ||
|
||
# The ID of the article. | ||
id: ID! | ||
|
||
# The name of the article. | ||
name: String! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
schema { | ||
query: QueryRoot | ||
} | ||
|
||
# An article that can be viewed and ordered. | ||
type Article { | ||
# A text describing the details of the article. | ||
description: String | ||
|
||
# The ID of the article. | ||
id: ID! | ||
|
||
# The name of the article. | ||
name: String! | ||
} | ||
|
||
# A catalog containing articles. | ||
type QueryRoot { | ||
# Finds a specific article listed in the catalog. | ||
article( | ||
# The ID of the article. | ||
articleId: ID! | ||
): Article | ||
|
||
# Lists all available articles in the catalog. | ||
articles: [Article] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
query All { | ||
articles { | ||
id | ||
name | ||
description | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
schema { | ||
query: QueryRoot | ||
} | ||
|
||
# An article that can be viewed and ordered. | ||
type Article { | ||
# The category this article belongs to. | ||
category: Category! | ||
|
||
# A text describing the details of the article. | ||
description: String | ||
|
||
# The ID of the article. | ||
id: ID! | ||
|
||
# The name of the article. | ||
name: String! | ||
} | ||
|
||
# A category that groups multiple articles. | ||
enum Category { | ||
# Physical books. | ||
BOOKS | ||
|
||
# Electronic devices. | ||
DEVICES | ||
} | ||
|
||
# A catalog containing articles. | ||
type QueryRoot { | ||
# Finds a specific article listed in the catalog. | ||
article( | ||
# The ID of the article. | ||
articleId: ID! | ||
): Article | ||
|
||
# Lists all available articles in the catalog. | ||
articles( | ||
# The category to list articles from. Can be omitted to not filter by category. | ||
category: Category | ||
): [Article] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
query Books { | ||
articles(category: BOOKS) { | ||
id | ||
name | ||
category | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
schema { | ||
query: QueryRoot | ||
} | ||
|
||
# An article that can be viewed and ordered. | ||
type Article { | ||
# The category this article belongs to. | ||
category: Category! | ||
|
||
# A text describing the details of the article. | ||
description: String | ||
|
||
# The ID of the article. | ||
id: ID! | ||
|
||
# The name of the article. | ||
name: String! | ||
|
||
# Articles recommended to buy along with this one. | ||
recommendations: [Article] | ||
} | ||
|
||
# A category that groups multiple articles. | ||
enum Category { | ||
# Physical books. | ||
BOOKS | ||
|
||
# Electronic devices. | ||
DEVICES | ||
} | ||
|
||
# A catalog containing articles. | ||
type QueryRoot { | ||
# Finds a specific article listed in the catalog. | ||
article( | ||
# The ID of the article. | ||
articleId: ID! | ||
): Article | ||
|
||
# Lists all available articles in the catalog. | ||
articles( | ||
# The category to list articles from. Can be omitted to not filter by category. | ||
category: Category | ||
): [Article] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
query Recommendations { | ||
article(articleId: "1") { | ||
id | ||
name | ||
recommendations { | ||
id | ||
name | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
schema { | ||
query: QueryRoot | ||
} | ||
|
||
# An article that can be viewed and ordered. | ||
type Article { | ||
# The category this article belongs to. | ||
category: Category! | ||
|
||
# A text describing the details of the article. | ||
description: String | ||
|
||
# The ID of the article. | ||
id: ID! | ||
|
||
# The name of the article. | ||
name: String! | ||
|
||
# The average rating of this article. | ||
rating: Float | ||
|
||
# Articles recommended to buy along with this one. | ||
recommendations: [Article] | ||
|
||
# The reviews posted for this article. | ||
reviews: [Review] | ||
} | ||
|
||
# A category that groups multiple articles. | ||
enum Category { | ||
# Physical books. | ||
BOOKS | ||
|
||
# Electronic devices. | ||
DEVICES | ||
} | ||
|
||
# A catalog containing articles. | ||
type QueryRoot { | ||
# Finds a specific article listed in the catalog. | ||
article( | ||
# The ID of the article. | ||
articleId: ID! | ||
): Article | ||
|
||
# Lists all available articles in the catalog. | ||
articles( | ||
# The category to list articles from. Can be omitted to not filter by category. | ||
category: Category | ||
): [Article] | ||
} | ||
|
||
# A review posted for an article. | ||
type Review { | ||
# The author of the review. | ||
author: String | ||
|
||
# The ISO 8601 date when the review has been posted. | ||
date: String | ||
|
||
# The ID of the review. | ||
id: ID! | ||
|
||
# The rating behind this review. | ||
rating: Int! | ||
|
||
# The review text. | ||
text: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
query Reviews { | ||
article(articleId: "5") { | ||
id | ||
name | ||
rating | ||
reviews { | ||
id | ||
author | ||
date | ||
rating | ||
text | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
schema { | ||
query: QueryRoot | ||
mutation: MutationRoot | ||
} | ||
|
||
# An article that can be viewed and ordered. | ||
type Article { | ||
# The category this article belongs to. | ||
category: Category! | ||
|
||
# A text describing the details of the article. | ||
description: String | ||
|
||
# The ID of the article. | ||
id: ID! | ||
|
||
# The name of the article. | ||
name: String! | ||
|
||
# The average rating of this article. | ||
rating: Float | ||
|
||
# Articles recommended to buy along with this one. | ||
recommendations: [Article] | ||
|
||
# The reviews posted for this article. | ||
reviews: [Review] | ||
} | ||
|
||
# A category that groups multiple articles. | ||
enum Category { | ||
# Physical books. | ||
BOOKS | ||
|
||
# Electronic devices. | ||
DEVICES | ||
} | ||
|
||
# The mutation root. | ||
type MutationRoot { | ||
# Posts a new review on an article. | ||
postReview( | ||
# The ID of the article. | ||
articleId: ID! | ||
|
||
# The input for posting the review. | ||
review: ReviewInput! | ||
): Article | ||
} | ||
|
||
# A catalog containing articles. | ||
type QueryRoot { | ||
# Finds a specific article listed in the catalog. | ||
article( | ||
# The ID of the article. | ||
articleId: ID! | ||
): Article | ||
|
||
# Lists all available articles in the catalog. | ||
articles( | ||
# The category to list articles from. Can be omitted to not filter by category. | ||
category: Category | ||
): [Article] | ||
} | ||
|
||
# A review posted for an article. | ||
type Review { | ||
# The author of the review. | ||
author: String | ||
|
||
# The ISO 8601 date when the review has been posted. | ||
date: String | ||
|
||
# The ID of the review. | ||
id: ID! | ||
|
||
# The rating behind this review. | ||
rating: Int! | ||
|
||
# The review text. | ||
text: String | ||
} | ||
|
||
# The input for reviewing an article. | ||
input ReviewInput { | ||
# The rating behind the review. | ||
rating: Int! | ||
|
||
# The review text. | ||
text: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
mutation PostReview { | ||
postReview( | ||
articleId: "2", | ||
review: { | ||
rating: 3 | ||
text: "meh" | ||
} | ||
) { | ||
id | ||
name | ||
rating | ||
reviews { | ||
id | ||
text | ||
rating | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"scripts": { | ||
"sync-schema": "babel-node sync-schema.js", | ||
"info": "npm-scripts-info", | ||
"start": "opn http://localhost:3000/graphql && nodemon src/server.js --exec babel-node --ext js,gql" | ||
}, | ||
"scripts-info": { | ||
"sync-schema": "Generate the schema.gql file from the schema defined in schema.js.", | ||
"info": "Print this info.", | ||
"start": "Starts the server, opens GraphiQL in the browser and watches for source file changes." | ||
}, | ||
"dependencies": { | ||
"babel-cli": "^6.24.0", | ||
"babel-plugin-inline-import": "^2.0.4", | ||
"babel-plugin-inline-json-import": "^0.2.1", | ||
"babel-preset-es2015": "^6.24.0", | ||
"babel-preset-es2016": "^6.22.0", | ||
"express": "^4.15.2", | ||
"express-graphql": "^0.6.3", | ||
"graphql": "^0.9.1", | ||
"lodash": "^4.17.4", | ||
"npm-scripts-info": "^0.3.6", | ||
"opn-cli": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"nodemon": "^1.11.0" | ||
} | ||
} |
Oops, something went wrong.