项目作者: Arjun-sna

项目描述 :
GraphQl server to get directions between two places(Uses Google directions API)
高级语言: JavaScript
项目地址: git://github.com/Arjun-sna/directions_graphql.git
创建时间: 2019-06-07T08:00:28Z
项目社区:https://github.com/Arjun-sna/directions_graphql

开源协议:MIT License

下载


Node GraphQL Server

Sample GraphQL nodejs server.

GraphQL wrapper over the Google directions API.

Graphiql

Frontend App

Sample Query

  1. fragment TransitPointDetailsParts on TransitPointDetails {
  2. formatedTime
  3. address
  4. timeZone
  5. timeValue
  6. location {
  7. latitude
  8. longitude
  9. }
  10. }
  11. fragment OtherPointDetailsParts on OtherPointDetails {
  12. address
  13. location {
  14. latitude
  15. longitude
  16. }
  17. }
  18. fragment TripDataPart on TripData {
  19. arrival {
  20. ... on TransitPointDetails {
  21. ...TransitPointDetailsParts
  22. }
  23. ... on OtherPointDetails {
  24. ...OtherPointDetailsParts
  25. }
  26. }
  27. departure {
  28. ... on TransitPointDetails {
  29. ...TransitPointDetailsParts
  30. }
  31. ... on OtherPointDetails {
  32. ...OtherPointDetailsParts
  33. }
  34. }
  35. tripDuration {
  36. ...TypedDataParts
  37. }
  38. tripDistance {
  39. ...TypedDataParts
  40. }
  41. }
  42. fragment TypedDataParts on TypedData {
  43. formattedValue
  44. rawValue
  45. }
  46. fragment CoordsPart on Coords {
  47. latitude
  48. longitude
  49. }
  50. query($coordinates: PlaceCoordinatesInput!, $travelMode: AllowTravelModes!) {
  51. direction(coordinates: $coordinates, travelMode: $travelMode) {
  52. fare {
  53. formattedFare
  54. currency
  55. fareValue
  56. }
  57. tripData {
  58. ...TripDataPart
  59. }
  60. steps {
  61. stepTravelMode
  62. stepDistance {
  63. ...TypedDataParts
  64. }
  65. stepDuration {
  66. ...TypedDataParts
  67. }
  68. startLocation {
  69. ...CoordsPart
  70. }
  71. endLocation {
  72. ...CoordsPart
  73. }
  74. polyline
  75. stepInstruction
  76. ... on WalkStep {
  77. walkSteps {
  78. stepTravelMode
  79. stepInstruction
  80. }
  81. }
  82. ... on TransitStep {
  83. arrival {
  84. ...TransitPointDetailsParts
  85. }
  86. departure {
  87. ...TransitPointDetailsParts
  88. }
  89. transitData {
  90. tripName
  91. tripShortName
  92. url
  93. headSign
  94. stopsCount
  95. vehicleIcon
  96. vehicleName
  97. vehicleType
  98. }
  99. }
  100. }
  101. }
  102. }
  103. input:
  104. {
  105. "coordinates": {
  106. "startLat": 37.7919227,
  107. "startLng": -122.4152148,
  108. "endLat": 37.6213171,
  109. "endLng": -122.3811441
  110. },
  111. "travelMode": "walking"
  112. }