🇮🇩 Indonesia Postal Code & Area in graphql
- Country (example:
INDONESIA
) - Province (example:
SUMATERA BARAT
) - City (example:
PADANG
) - DistrictOne as Kecamatan in Bahasa (example:
PADANG UTARA
) - DistrictTwo as Kelurahan in Bahasa (example:
LOLONG BELANTI
) - PostalCode (example:
25136
)
{
countryByCode(code: "ID") {
code
iso3
name
phoneCode
emoji
}
provinces(filter: { name: { eq: "SUMATERA BARAT" } }) {
id
code
name
cities {
id
code
name
postal
}
}
}
The above GraphQL query will produce the following JSON response:
{
"data": {
"countryByCode": {
"code": "ID",
"iso3": "IDN",
"name": "INDONESIA",
"phoneCode": "62",
"emoji": "🇮🇩"
},
"provinces": [
{
"id"<
8A1E
/span>: 3,
"code": "13",
"name": "SUMATERA BARAT",
"cities": [
{
"id": 57,
"code": "1301",
"name": "KEPULAUAN MENTAWAI",
"postal": "25700,25300"
}
]
}
]
}
}
You may need install some of this:
- npm (Node version >= 16)
- PostgreSQL
- clone this repo :)
cp .env.example .env
npm run install
Fill with valid values
it will be store as .ts
in migration
table
npx mikro-orm migration:up
it will be store as .ts
in migration
table
npm run db:migrate:ts
it will be store as .js
in migration
table
npm run db:migrate
npm run db:seed
npm run dev
GraphQL playground in http://localhost:3000/graphql
npm run build
npm start
Big thanks for this repos and tutorials 🍻