-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graphql): add an extension for type-graphql integration
Signed-off-by: Raymond Feng <[email protected]>
- Loading branch information
1 parent
8f88793
commit 67645aa
Showing
49 changed files
with
5,147 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
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 @@ | ||
--- | ||
lang: en | ||
title: 'GraphQL' | ||
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, GraphQL | ||
layout: readme | ||
source: loopback-next | ||
file: extensions/graphql/README.md | ||
sidebar: lb4_sidebar | ||
permalink: /doc/en/lb4/GraphQL.html | ||
--- |
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
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
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 @@ | ||
package-lock=true |
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 @@ | ||
Copyright (c) IBM Corp. 2020. | ||
Node module: @loopback/example-graphql | ||
This project is licensed under the MIT License, full text below. | ||
|
||
-------- | ||
|
||
MIT License | ||
|
||
MIT License Copyright (c) IBM Corp. 2020 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice (including the next | ||
paragraph) shall be included in all copies or substantial portions of the | ||
Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,75 @@ | ||
# @loopback/example-graphql | ||
|
||
An example application to demonstrate GraphQL integration for LoopBack 4 using | ||
[@loopback/graphql](https://github.com/strongloop/loopback-next/tree/graphql/extensions/graphql). | ||
|
||
## Try it out | ||
|
||
```sh | ||
npm start | ||
``` | ||
|
||
You should see the following messages: | ||
|
||
```sh | ||
Server is running at http://[::1]:3000 | ||
Try http://[::1]:3000/graphql | ||
``` | ||
|
||
Open http://127.0.0.1:3000/graphql in your browser to play with the GraphiQL. | ||
|
||
![graphql-demo](graphql-demo.png) | ||
|
||
1. Copy the query to the right panel: | ||
|
||
```graphql | ||
query GetRecipe1 { | ||
recipe(recipeId: "1") { | ||
title | ||
description | ||
ratings | ||
creationDate | ||
ratingsCount(minRate: 2) | ||
averageRating | ||
ingredients | ||
numberInCollection | ||
} | ||
} | ||
``` | ||
|
||
2. Click on the run icon: | ||
|
||
```json | ||
{ | ||
"data": { | ||
"recipe": { | ||
"title": "Recipe 1", | ||
"description": "Desc 1", | ||
"ratings": [0, 3, 1], | ||
"creationDate": "2018-04-11T00:00:00.000Z", | ||
"ratingsCount": 1, | ||
"averageRating": 1.3333333333333333, | ||
"ingredients": ["one", "two", "three"], | ||
"numberInCollection": 1 | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Contributions | ||
|
||
- [Guidelines](https://github.com/strongloop/loopback-next/blob/master/docs/CONTRIBUTING.md) | ||
- [Join the team](https://github.com/strongloop/loopback-next/issues/110) | ||
|
||
## Tests | ||
|
||
Run `npm test` from the root folder. | ||
|
||
## Contributors | ||
|
||
See | ||
[all contributors](https://github.com/strongloop/loopback-next/graphs/contributors). | ||
|
||
## License | ||
|
||
MIT |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.