This microservice provides a random city.
To programmatically request data, make an HTTP GET request to:
https://cs-361-microservice.vercel.app/api/random-city
Example Request:
import fetch from "node-fetch";
const testMicroservice = async () => {
try {
const response = await fetch("https://cs-361-microservice.vercel.app/api/random-city");
const data = await response.json();
console.log("Response from microservice:", data);
} catch (error) {
console.error("Error calling microservice:", error);
}
};
testMicroservice();
The response is a JSON object containing details of a random city.
Example Response:
"city": {
"id": 3850019,
"type": "CITY",
"city": "Berlin",
"country": "Germany",
"countryCode": "DE",
"region": "Berlin",
"latitude": 52.516666666,
"longitude": 13.383333333,
"population": 3755251
}
