Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mattforgh/graphql-go-onepieceapi

Basic One Piece (famous manga) API developed in Go & GraphQL, returns the Strawhats crew information, and give you the possibility to create new pirates & crews.
https://github.com/mattforgh/graphql-go-onepieceapi

api backend frontend go golang golang-application golang-examples google graphql graphql-api graphql-client graphql-server manga onepiece

Last synced: 3 months ago
JSON representation

Basic One Piece (famous manga) API developed in Go & GraphQL, returns the Strawhats crew information, and give you the possibility to create new pirates & crews.

Awesome Lists containing this project

README

        

One Piece Api


Basic API developed in Go & GraphQL







![One_Piece_Anime_Logo](https://user-images.githubusercontent.com/38867931/178217876-43b54feb-15f1-4709-9f81-15d836e62f18.png)


## About The Project
basic One Piece (famous manga) API that returns the Strawhats crew information, and give you the possibility to create new crews.

### Built With
* [Go](https://go.dev/)
* [GraphQL](https://graphql.org/)

## Getting Started
Start the server :
```sh
go run .
```

## Usage

Using GraphQL playground in http://localhost:8080/ (in my case) you can try this Queries and Mutations

* Get all the strawhats crew
```graphql
query findPirates{
strawhats{
name
image
bounty
crew
id
}
}
```

Output :

```graphql
{
"data": {
"strawhats": [
{
"name": "Monkey D. Luffy",
"image": "https://rb.gy/xz0x9h",
"bounty": "1,500,000,000",
"crew": "Strawhats",
"id": "01"
},
{
"name": "Roronoa Zoro",
"image": "https://rb.gy/imkdhx",
"bounty": "320,000,000",
"crew": "Strawhats",
"id": "02"
},
{
"name": "Nami",
"image": "https://rb.gy/dncyia",
"bounty": "66,000,000",
"crew": "Strawhats",
"id": "03"
},
{
"name": "God Usop",
"image": "https://rb.gy/xa68o1",
"bounty": "200,000,000",
"crew": "Strawhats",
"id": "04"
},
{
"name": "Vinsmoke Sanji ",
"image": "https://rb.gy/sofr7o",
"bounty": "330,000,000",
"crew": "Strawhats",
"id": "05"
},
{
"name": "Tony Tony Chopper",
"image": "https://rb.gy/oh2nmv",
"bounty": "100",
"crew": "Strawhats",
"id": "06"
},
{
"name": "Nico Robin",
"image": "https://rb.gy/5puvys",
"bounty": "130,000,000",
"crew": "Strawhats",
"id": "07"
},
{
"name": "Brook",
"image": "https://rb.gy/5kelik",
"bounty": "83,000,000",
"crew": "Strawhats",
"id": "08"
},
{
"name": "Jimbei",
"image": "https://rb.gy/mafbmm",
"bounty": "83,000,000",
"crew": "Strawhats",
"id": "09"
},
{
"name": "Neferutari Bibi",
"image": "https://rb.gy/zddixu",
"bounty": "0",
"crew": "Strawhats",
"id": "11"
}
]
}
}
```

---

* Create your crew, adding new pirates
```graphql
mutation createPirate {
createPirate(input: { name: "Marco", pirateId: "1",bounty:" 1.374.000.000",crew:"Whitebeard crew",image:"null"}) {
name
id
}
}
```

Output :

```graphql
{
"data": {
"createPirate": {
"name": "Marco",
"id": "T8674665223082153551",
}
}
}
```

---

* Return the created pirates
```graphql
query findPirates{
pirates{
name
id
bounty
crew
image //optional
}
}
```

Output :

```graphql
{
"data": {
"pirates": [
{
"name": "Edward Newgate",
"id": "T5577006791947779410",
"bounty": "5,046,000,000",
"crew": "Whitebeard crew",
"image": null
},
{
"name": "Marco",
"id": "T8674665223082153551",
"bounty": "1.374.000.000",
"crew": "Whitebeard crew",
"image": "null"
}
]
}
}
```

---

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again! ❤️

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

(back to top)

## Contact

Matteo Leonesi - [Linkedin](https://www.linkedin.com/in/matteo-leonesi-228867138/) - [email protected]

Project Link: [GraphQL-Go-onepieceAPI](https://github.com/MatteoLeonesi/GraphQL-Go-onepieceAPI)

(back to top)