1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00
Files
kararas_iris/_examples/graphql/schema-first
dependabot[bot] 38c0af56c7 Bump the go_modules group across 2 directories with 1 update
Bumps the go_modules group with 1 update in the /_examples/configuration/viper directory: [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure).
Bumps the go_modules group with 1 update in the /_examples/graphql/schema-first directory: [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure).


Updates `github.com/go-viper/mapstructure/v2` from 2.2.1 to 2.4.0
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.4.0)

Updates `github.com/go-viper/mapstructure/v2` from 2.2.1 to 2.4.0
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
  dependency-group: go_modules
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-15 09:57:55 +00:00
..
2025-08-15 23:29:20 +03:00
2023-02-07 03:01:24 +02:00
2023-03-11 22:37:55 +02:00
2023-02-07 03:01:24 +02:00
2023-02-07 03:01:24 +02:00

outerbanks-api

A graphql api where we can store and get information on characters in Outerbanks.

This example is an updated version (2023) of outerbanks-api and it is based on: https://www.apollographql.com/blog/graphql/golang/using-graphql-with-golang.

Getting Started

$ go install github.com/99designs/gqlgen@latest

Add gqlgen to your project's tools.go file

$ printf '// +build tools\npackage tools\nimport _ "github.com/99designs/gqlgen"' | gofmt > tools.go
$ go get github.com/kataras/iris/v12@latest
$ go mod tidy -compat=1.20

Start the graphql server

$ go run .

Mutation

Open http://localhost:8080

On the editor panel paste:

mutation upsertCharacter($input:CharacterInput!){
  upsertCharacter(input:$input) {
  	name
    id
  }
}

And in the variables panel below, paste:

{
  "input":{
   	"name": "kataras",
    "cliqueType": "POGUES"
  }
}

Hit Ctrl+Enter to apply the mutation.

Query

Query:

query character($id:ID!) {
  character(id:$id) {
    id
    name
  }
}

Variables:

{
 "id":1
}

Re-generate code

$ cd graph
$ rm -f graph/schema.resolvers.go
$ touch schema.graphql # make your updates here
$ gqlgen generate