-
Notifications
You must be signed in to change notification settings - Fork 839
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
Showing
3 changed files
with
31 additions
and
21 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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
# Go GraphQL CRUD example | ||
|
||
Implementation create, read, update and delete on Go | ||
Implement create, read, update and delete on Go. | ||
|
||
To run the program, go to the directory | ||
`cd examples/crud` | ||
To run the program: | ||
|
||
Run the example | ||
`go run main.go` | ||
1. go to the directory: `cd examples/crud` | ||
2. Run the example: `go run main.go` | ||
|
||
## Create | ||
|
||
`http://localhost:8080/product?query=mutation+_{create(name:"Inca Kola",info:"Inca Kola is a soft drink that was created in Peru in 1935 by British immigrant Joseph Robinson Lindley using lemon verbena (wiki)",price:1.99){id,name,info,price}}` | ||
|
||
## Read | ||
Get single product by id | ||
`http://localhost:8080/product?query={product(id:1){name,info,price}}` | ||
|
||
Get product list | ||
`http://localhost:8080/product?query={list{id,name,info,price}}` | ||
* Get single product by id: `http://localhost:8080/product?query={product(id:1){name,info,price}}` | ||
* Get product list: `http://localhost:8080/product?query={list{id,name,info,price}}` | ||
|
||
## Update | ||
|
||
`http://localhost:8080/product?query=mutation+_{update(id:1,price:3.95){id,name,info,price}}` | ||
|
||
## Delete | ||
|
||
`http://localhost:8080/product?query=mutation+_{delete(id:1){id,name,info,price}}` |
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