dylanblokhuis / country-city-api

Easy web service to fetch all countries including cities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Country City API

Simple node.js microservice that provides up-to-date country and city names from United Nations Economic Commission for Europe

Quick start

npm install

npm run start

Quick start with Docker

Pull latest image from registry
docker pull dylanblokhuis/country-city-api

Start the container
docker run -d -p 3000:3000 dylanblokhuis/country-city-api

Open localhost:3000 to see if it's working.

Routes

/countries

Response

[
    ...
    {
        "countryCode": "NL",
        "url": "https://service.unece.org/trade/locode/nl.htm",
        "name": "Netherlands"
    },
    {
        "countryCode": "NC",
        "url": "https://service.unece.org/trade/locode/nc.htm",
        "name": "New Caledonia"
    },
    {
        "countryCode": "NZ",
        "url": "https://service.unece.org/trade/locode/nz.htm",
        "name": "New Zealand"
    },
    ...
]

/countries/:countryCode

Example: /countries/NL

Response

[
  "Aa en Hunze",
  "Aalburg",
  "Aalsmeer",
  "Aalsmeerderbrug",
  "Aalst",
  "Aalten",
  "Aan de Zuwe",
  "Aardenburg",
  "Aarlanderveen",
  "Aarle Rixtel",
  "Abbegaasterketting",
  "Abbekerk",
  "Abbenbroek",
  ...
]

About

Easy web service to fetch all countries including cities

License:MIT License


Languages

Language:TypeScript 92.6%Language:Dockerfile 7.2%Language:Shell 0.3%