top
(README.md)
# CMPE273_Assignment-3
Replace YOUR_UBER_ACCESS_TOKEN with your value.
const key = "YOUR_UBER_ACCESS_TOKEN"

Run The program with the below command :
go run Assingment3.go

The location generated from the first assingment is as follows :
                                                                            Location id:
1.Fairmont Hotel, San Francisco (950 Mason St,San Francisco,CA 94108)       //565188af3bc84706e4b2a8c7
2: Golden Gate Bridge,California                                            //565188cf3bc84706e4b2a8c8
3: Pier 39 (Beach Street and The Embarcadero,San Francisco,CA 94133 )       //565240ae3bc8471374ccd91f
4: Golden gate Park                                                         //56525c773bc8471374ccd920
5: Twin Peaks (501 Twin Peaks Blvd,San Francisco,CA 94114)                  //5651894c3bc84706e4b2a8cb

Post Request :
http://localhost:8082/trips
request body :
{
    "starting_from_location_id": "565188af3bc84706e4b2a8c7",
    "location_ids" : [ "565188cf3bc84706e4b2a8c8", "565240ae3bc8471374ccd91f", "56525c773bc8471374ccd920","5651894c3bc84706e4b2a8cb" ] 
}

Response :


{
  "id": 4900,
  "status": "planning",
  "starting_from_location_id": "565188af3bc84706e4b2a8c7",
  "best_route_location_ids": [
    "565240ae3bc8471374ccd91f",
    "565188cf3bc84706e4b2a8c8",
    "56525c773bc8471374ccd920",
    "5651894c3bc84706e4b2a8cb"
  ],
  "total_uber_costs": 68,
  "total_uber_duration": 4968,
  "total_distance": 23.120000000000005
}


Get Request :
http://localhost:8082/trips/4900
Response :

{
  "id": 4900,
  "status": "planning",
  "starting_from_location_id": "565188af3bc84706e4b2a8c7",
  "best_route_location_ids": [
    "565240ae3bc8471374ccd91f",
    "565188cf3bc84706e4b2a8c8",
    "56525c773bc8471374ccd920",
    "5651894c3bc84706e4b2a8cb"
  ],
  "total_uber_costs": 68,
  "total_uber_duration": 4968,
  "total_distance": 23.120000000000005
}


Put Request :

http://localhost:8082/trips/4900/request



Response :


{
  "id": 4900,
  "status": "processing",
  "starting_from_location_id": "565188af3bc84706e4b2a8c7",
  "next_destination_location_id": "565240ae3bc8471374ccd91f",
  "best_route_location_ids": [
    "565240ae3bc8471374ccd91f",
    "565188cf3bc84706e4b2a8c8",
    "56525c773bc8471374ccd920",
    "5651894c3bc84706e4b2a8cb"
  ],
  "total_uber_costs": 68,
  "total_uber_duration": 4968,
  "total_distance": 23.120000000000005,
  "uber_wait_time_eta": 13
}


Multiple put request will change the next_destination_location_id.

Imports 3 package(s) ΒΆ

  1. gopkg.in/mgo.v2
  2. gopkg.in/mgo.v2/bson
  3. github.com/julienschmidt/httprouter