Example go graphql using library gqlgen
🏠 Homepage
create .env file
DATA_SOURCE="your-database-source"
PORT=8080
GOLANG_ENV="test"
make test
go run server.go
make check
make format
💡 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
}
}
👤 Felix Fernando
- Website: voltgizerz.github.io
- Twitter: @felix_fernand0
- Github: @voltgizerz
- LinkedIn: @felix-fernando-wijaya
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator