Readme changes
This commit is contained in:
parent
cea33e9d36
commit
73fac765de
28
README.md
28
README.md
|
@ -1,3 +1,31 @@
|
|||
# gographql
|
||||
|
||||
Exemple d'API GraphQL, PostgresQL, en Go
|
||||
|
||||
```
|
||||
go build && go run .
|
||||
```
|
||||
|
||||
## Query
|
||||
Toute rếquete visant à récupérer une donnée est appellée une 'Query'
|
||||
|
||||
```
|
||||
# Exemple de Query
|
||||
|
||||
curl -X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"query": "{ user { id,firstname,lastname,roles{name} } }"}' \
|
||||
http://localhost:8383/
|
||||
|
||||
```
|
||||
|
||||
## Mutation
|
||||
Toute requếte visant à modifier une donnée est appellée une 'Mutation'
|
||||
|
||||
```
|
||||
curl -X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"query": "mutation { createUser(firstname: \"John\", lastname: \"Snow\") { id,firstname,lastname } }"}' \
|
||||
http://localhost:8383
|
||||
|
||||
```
|
1
main.go
1
main.go
|
@ -32,6 +32,7 @@ func main() {
|
|||
|
||||
httpHandler := handler.New(&handler.Config{
|
||||
Schema: &schema,
|
||||
Pretty: true,
|
||||
})
|
||||
|
||||
postgres.DBConnect()
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
|
||||
// GetUserQuery returns the queries available against user type.
|
||||
func GetUserQuery() *graphql.Field {
|
||||
log.Print("GetUserQuery")
|
||||
return &graphql.Field{
|
||||
Type: graphql.NewList(types.UserType),
|
||||
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
|
||||
|
|
Loading…
Reference in New Issue