hhstore / blog

My Tech Blog: about Mojo / Rust / Golang / Python / Kotlin / Flutter / VueJS / Blockchain etc.
https://github.com/hhstore/blog/issues
291 stars 24 forks source link

API Design: GraphQL #68

Open hhstore opened 6 years ago

hhstore commented 6 years ago

graphql:

ORM:

hhstore commented 6 years ago

ref:

relay:

react-apollo:

etc:

hhstore commented 6 years ago

Python:

重要功能点:

pagination 分页:

relay:

示例 API 数据:


query {
  allStarships{

    totalCount,
    pageInfo{
      hasNextPage,
      hasPreviousPage
    }
    starships {
      name,
      model,
      crew,
      passengers,
    }

  }

}

## 注释:

{
  allStarships {
    totalCount
    starships {
      name
      model
    }
  }
}

########

query {

  person(personID: 1) {
    name,
    id,
    height,
    skinColor,
  }

  allPeople {
    people {
      name,
      id,
      gender
    }
  }

  allStarships{

    totalCount,
    pageInfo{
      hasNextPage,
      hasPreviousPage,

    }
    starships {
      name,
      model,
      crew,
      passengers,
      manufacturers
    }

  }

}

django + graphql:

flask + graphql:

hhstore commented 6 years ago

前端: react.js + grapql

hhstore commented 5 years ago

golang + graphql:

项目实践: