https://postcoder.thelookoutway.net/
Microservice to return surrounding postcodes given an Australian postcode. Leverages the australia_postcode
gem. All distance calculations are performed in memory.
- Ruby MRI 3.1.2
- Rails 7.0.2.3
API_TOKEN
secret environment variable- direnv (recommended for development)
- nix (recommended for development)
There's no database, australia_postcode
reads data from a CSV.
The service only has one endpoint, /
. Target this with a GET
request, supplying the api_token
and postcode
query parameters, and you'll receive a JSON response of the shape:
{
"3": [<array of integer postcodes>],
"7": [<array of integer postcodes>],
"10": [<array of integer postcodes>],
"20": [<array of integer postcodes>],
}
e.g.:
$ curl "http://localhost:3000/?api_token=ASDF&postcode=2752"
# => {"3":[2752],"7":[2570,2752],"10":[2570,2745,2752],"20":[2555,2556,2557,2567,2570,2745,2752,2773]}
Install the application's dependencies:
$ bundle
Start the application server:
$ bundle exec rails server
Run the entire test suite.
$ bundle exec rspec
This application is automatically deployed when commits are pushed to the main branch and the tests on the main branch pass.