An example of a Node.js Microservice which provides an endpoint for searching for clinics by postcode.
It also provides an endpoint which responds with a list of partial postcodes within the city and the number of clinics within the postcode.
The app is hosted on Heroku.
This endpoint accepts a UK postcode, such as CR9 1PJ.
Here is an example URL that calls the API endpoint:
https://clinics-api.herokuapp.com/clinics/postcode/cr91pj
It provides a JSON response with results that match the full postcode only:
{
"results" : [
{
"organisation_id" : "58961",
"name" : "Edridge Road Community Health Centre"
},
{
"organisation_id" : "77668",
"name" : "Edridge Road Walk-In Centre"
}
]
}
The second endpoint accepts the name of a city such as Croydon.
Here is an example URL that calls the API endpoint:
https://clinics-api.herokuapp.com/clinics/city/croydon
It provides a JSON response with a results object that contains all of the partial postcodes found and how many of them where found.
{
"results" : {
"CR9" : 2,
"CR0" : 8
}
}