kg-kartik / Ambulance-on-demand

Connecting Ambulance and Patients in real time
17 stars 9 forks source link

after setting mongo uri , npm run dev , then localhost:3000/01 crashes "cant read property location" #1

Closed hichemsmairia closed 4 years ago

hichemsmairia commented 4 years ago

after setting mongo uri , npm run dev , then localhost:3000/01 crashes "cant read property location"

kg-kartik commented 4 years ago

after setting mongo uri , npm run dev , then localhost:3000/01 crashes "cant read property location"

As no API is being used for fetching ambulance data, so you need to set up your database and seed the sample data as per the schema in the models folder.

hichemsmairia commented 4 years ago

have u just an example of ambulance database ? or how can i add it manually in the mongodb cluster

kg-kartik commented 4 years ago

You can save data in a NoSQL Database like this Here is the sample data - { "location": { "type":"Point", "coordinates":[77.63997110000003,13.0280047], "address":"Kalyan Nagar, Bengaluru,Karnataka,India" }, "ambulanceid":"01", "displayName":"Ambulance 001", "phone":"1", "email":"ambulance01@gmail.com" }

hichemsmairia commented 4 years ago

well it works but when openign localhost:3000/01 .. it keep saying "fetching patients requests" even after i actually send the help request

kg-kartik commented 4 years ago

Actually, I have mentioned an arbitary distance of 5000 units on line no 75 - const nearestAmbulance =otherMethod(location.coordinates[0],location.coordinates[1],5000); of server.js , and that is the distance from the patient to the ambulance location upto which ambulance will be searched , and therefore I guess the distance between the patient location which you have set and the location coordinates of the ambulance (sample data) which you have seeded is greater than that distance.

hichemsmairia commented 4 years ago

am gonna check it