项目作者: sharadcodes

项目描述 :
COVID19 Graphql Server
高级语言: JavaScript
项目地址: git://github.com/sharadcodes/covid19-graphql.git
创建时间: 2020-03-22T11:25:40Z
项目社区:https://github.com/sharadcodes/covid19-graphql

开源协议:MIT License

下载


COVID19-Graphql

By sharadcodes

GOTO: https://sharad-gql-covid19.herokuapp.com/graphql

HOW TO USE

Example using fetch

  1. fetch(
  2. "https://sharad-gql-covid19.herokuapp.com/graphql",
  3. {
  4. method: "POST",
  5. headers: { "Content-Type": "application/json" },
  6. body: JSON.stringify({
  7. query: `{
  8. countries {
  9. country
  10. countryInfo {
  11. lat
  12. long
  13. }
  14. cases
  15. todayCases
  16. deaths
  17. todayDeaths
  18. recovered
  19. active
  20. critical
  21. casesPerOneMillion
  22. deathsPerOneMillion
  23. }
  24. }
  25. `
  26. })
  27. }
  28. )
  29. .then(res => res.json())
  30. .then(res => console.log(res.data));

FOR SORTING DATA

Use sortBy followed by the key name and order folowed by either desc or aesc.

sortBy is cases by default & order is desc by default.

  1. fetch(
  2. "https://sharad-gql-covid19.herokuapp.com/graphql",
  3. {
  4. method: "POST",
  5. headers: { "Content-Type": "application/json" },
  6. body: JSON.stringify({
  7. query: `{
  8. countries(sortBy: "cases", order: "desc") {
  9. country
  10. countryInfo {
  11. lat
  12. long
  13. }
  14. cases
  15. todayCases
  16. deaths
  17. todayDeaths
  18. recovered
  19. active
  20. critical
  21. casesPerOneMillion
  22. deathsPerOneMillion
  23. }
  24. }
  25. `
  26. })
  27. }
  28. )
  29. .then(res => res.json())
  30. .then(res => console.log(res.data));

SHOWCASE

Project Github Repo Live Demo
COVIDLIVE https://github.com/giacomoalonzi/covidlive.it https://covidlive.it/