Git Product home page Git Product logo

car-graphql-api's Introduction

Car GraphQL API

Build Status

This is a simple GraphQL model API written in JAVA 12 with Spring Boot and GraphQL Schema Publisher & Query Resolver - SPQR.

Environment Provisioning

  • Download the project: $ git clone https://github.com/euiagosilva/car-graphql-api.git
  • Solve dependencies: $ ./gradlew clean build -x test
  • Testing execution: $ ./gradlew test
  • Install Docker and Docker Compose in your OS;
  • Create the postgres database container: $ docker-compose -f docker/docker-compose-postgres.yml up

Run Application

  • Execute: $ ./gradlew bootRun
  • Access: http://localhost:8081/graphiql

Executing Operations

Mutations

  • Save a Car:

    mutation {
       saveCar(car: {
         brand: "BMW"
         color: "Black"
         description: "BMW M5 First Edition inspired by BMW Individual"
         price: 78.890
         year: 2017
         model: "M5 Sedan"
         isNew: false
       }) {
           id
       }
    }
    
  • Update a Car:

    mutation {
       updateCar(car: {
         id: 1
         brand: "BMW"
         color: "Yellow"
         description: "BMW M5 First Edition inspired by BMW Individual"
         price: 78.890
         year: 2018
         model: "M5 Sedan"
         isNew: false
       }) {
           id
       }
    }
    
  • Deletes a car by id:

    mutation {
      deleteCar(id: 1)
    }
    

Queries

  • Gets all cars:

    {
       cars {
         id
         brand
         color
       }
    }
    
  • Gets a car by id:

    { 
       car(id: 1) {
         price
         year
       }
    }
    

REST Support

It's possible perform REST operations on API using Swagger UI. Only access: http://localhost:8081/swagger-ui.hml;

Meta

Iago Paixão[email protected]

distributed under MIT license

https://github.com/euiagosilva/car-graphql-api

car-graphql-api's People

Contributors

iagopaixao avatar

Watchers

James Cloos 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.