Git Product home page Git Product logo

graphql-go-onepieceapi's Introduction

One Piece Api

Basic API developed in Go & GraphQL

One_Piece_Anime_Logo

About The Project

In my opinion the best way to study new techologies is to make projects, so while studying Go and GraphQL i decided to create a basic One Piece (famous manga) API that returns the Strawhats crew information, and give you the possibility to create new crews.

Built With

Getting Started

Start the server :

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
  query findPirates{
  strawhats{
    name
    image
    bounty
    crew
    id
  }
}
Output :
{
"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
 mutation createPirate {
  createPirate(input: { name: "Marco", pirateId: "1",bounty:" 1.374.000.000",crew:"Whitebeard crew",image:"null"}) {
	  name
	  id
  }
}
Output :
{
"data": {
  "createPirate": {
    "name": "Marco",
    "id": "T8674665223082153551",
  }
}
}

  • Return the created pirates
 query findPirates{
  pirates{
    name
    id
    bounty
    crew
    image //optional
  }
}
Output :
{
"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 - [email protected]

Project Link: GraphQL-Go-onepieceAPI

(back to top)

graphql-go-onepieceapi's People

Contributors

mattforgh avatar makifdb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.