Skip to content

voltgizerz/go-graphql

Repository files navigation

GraphQL GO using GQLGEN 👋

Version Twitter: felix_fernand0

Example go graphql using library gqlgen

Installation

create .env file
DATA_SOURCE="your-database-source"
PORT=8080
GOLANG_ENV="test"

Test

make test

Usage

go run server.go

Linter

make check

Fix Linter

make format

GraphQL Features

💡 Request Header

{
  "Authorization":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NzA2NzI0MjQsImlzcyI6Impob24iLCJVc2VySUQiOjgxLCJVc2VybmFtZSI6ImZlbGl4IiwiTmFtZSI6IkZlbGl4IiwiSXNBZG1pbiI6dHJ1ZSwiRXhwaXJlc0F0IjoxNjcwNjcyNDI0fQ.noKdYN3fhr7iwQmlDy1xYn1FqLsZ4gY-ORkWf3oeP_I"
}

💡 Query

  • Login get token
query login {
  login(input: {username: "felix", password: "felix"}) {
    success
    message
    token
  }
}
  • Show all data pokemon (limit, offset, sort)
query pokemons {
  pokemons {
    id
    height
    name
  }
}
  • Show data pokemon by ID
query pokemon {
  pokemon(pokemonID: 1) {
    name
    types {
      id
    }
    height
    weight
  }
}

💡 Mutation

  • Update Pokemon
mutation update{
  updatePokemon(input:{id: 1}){
    success
    pokemon{id}
  }
}
  • Delete Pokemon
mutation delete {
  deletePokemon(input:{id:11}){
    success
  }
}

Author

👤 Felix Fernando

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

Releases

No releases published

Packages

No packages published

Languages