Closed hichemsmairia closed 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.
have u just an example of ambulance database ? or how can i add it manually in the mongodb cluster
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" }
well it works but when openign localhost:3000/01 .. it keep saying "fetching patients requests" even after i actually send the help request
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.
am gonna check it
after setting mongo uri , npm run dev , then localhost:3000/01 crashes "cant read property location"