Git Product home page Git Product logo

guoi-cloud-hello's Introduction

Introduction

Sample Hello Application demostrate following modules:

  • gateway-hello-graphql

    implements graphql query and mutation for Hello by calling grpc apis provided by micro-hello-grpc

  • micro-hello-grpc

    implements grpc micro service for Hello CRUD

API Design Guide

How to use guo-micro-apis in your JAVA application

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Find the dependencies

https://jitpack.io/com/github/conanchen/guoi-micro-apis/master-SNAPSHOT/build.log

Build artifacts:
...
com.github.conanchen.guoi-micro-apis:hello-grpc-java:master-5efdd7e810-1
...

Step 3. Add Dependencies Cache Configuration To Your Main-module build.gradle

configurations.all {
    //每隔10分钟..
    resolutionStrategy.cacheChangingModulesFor 10, 'minutes'
}

Step 4. Add Dependencies As Needed To Your Sub-module build.gradle

dependencies {
    compile ("com.github.conanchen.guoi-micro-apis:authcow-grpc-java:master-SNAPSHOT"){ changing = true }
    compile ("com.github.conanchen.guoi-micro-apis:gis-asset-grpc-java:master-SNAPSHOT"){ changing = true }
}

Step 5. Refresh Dependencies & Skip Test

export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;

gradle build --refresh-dependencies -x test

How it works

Step 1. open browser http://localhost:9000/graphiql

Step 2. query

hellos query

{
  hellos(first: 3) {
    edges {
      cursor
      node {
        id
        lastName
        firstName
        message
      }
    }
  }
}

hellos result

{
  "data": {
    "hellos": {
      "edges": [
        {
          "cursor": "aGVsbG9zLzk0ODFhODJjLWJiNDMtNGMzZi04OTE2LTUwMmM5NTFkMDdjZg==",
          "node": {
            "id": "hellos/9481a82c-bb43-4c3f-8916-502c951d07cf",
            "lastName": "unknown",
            "firstName": "unknown",
            "message": "Hello conan, Welcome to Guoi Micro$!"
          }
        },
        {
          "cursor": "aGVsbG9zLzlmZjU3NTlhLTc3YmItNDJkYi05NzJiLWFhOTg4NTdmNTdhMQ==",
          "node": {
            "id": "hellos/9ff5759a-77bb-42db-972b-aa98857f57a1",
            "lastName": "unknown",
            "firstName": "unknown",
            "message": "Hello lihai, Welcome to Guoi Micro$!"
          }
        }
      ]
    }
  }
}          

Step 3. Mutation

hello create

  • mutation
mutation ($input:HelloCreateInput!){
  hello0Create(input:$input){
    hello{
      id
      firstName
      lastName
      message
    }
  }
}
  • Query Variables
{
  "input": {
    "firstName":  "conan",
    "lastName":  "chen"
  }
}

hello create result

{
  "data": {
    "hello0Create": {
      "hello": {
        "id": "hellos/83ffb798-f44b-42ae-beca-036a1b486b96",
        "message": "Hello chen conan, Welcome to Guoi Micro$!",
        "create_time": "2018-04-06T07:36:10.935Z",
        "update_time": "2018-04-06T07:36:10.935Z"
      }
    }
  }
}

Run Test Cases

On Windows if you encounter bellow errors:

Caused by: java.io.IOException: Could not open inputStream for https://downloads.mongodb.org/win32/mongodb-win32-x86_64-3.2.2.zip
	at de.flapdoodle.embed.process.store.Downloader.downloadInputStream(Downloader.java:131)
	at de.flapdoodle.embed.process.store.Downloader.download(Downloader.java:69)
	at de.flapdoodle.embed.process.store.ArtifactStore.checkDistribution(ArtifactStore.java:66)
	at de.flapdoodle.embed.process.store.ExtractedArtifactStore.checkDistribution(ExtractedArtifactStore.java:60)

Building ahead of time for guoi-cloud-hello

You can also build snapshots on each commit if you add GitHub Webhooks.

To add, head to repository Settings -> Webhooks & Services -> Add webhook.

Webhook URL: https://jitpack.io/api/webhooks

Content type: application/json

The webhook will trigger a build for branches that you have previously used with JitPack. So make sure you have requested master-SNAPSHOT from JitPack before adding a webhook.

Pagination

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.