Search code examples
loopbackjs

lat must be a number when creating a GeoPoint


I'm using Loopback 3.x. I got an error lat must be a number when creating a GeoPoint while creating a custom API for finding nearby doctors.

user.json file

"findNearByDoctors": {
  "accepts": [
    {
      "arg": "geoPoint",
      "type": "geopoint",
      "required": true,
      "description": "user's location"
    },
    {
      "arg": "range",
      "type": "number",
      "required": false,
      "description": "range"
    }
  ],
  "returns": [],
  "description": "find nearby doctors",
  "http": [
    {
      "path": "/get-nearby-doctors",
      "verb": "get"
    }
  ]
}

Input I given is

geoPoint: (1.28210155945393, 103.81722480263163)


Solution

  • geoPoint: {"lat": 1.28210155945393, lng": 103.81722480263163}