Custom Extension UK Postcode validator and reformatter (node & PHP)

UK specific but as i wrote it I thought i would share it anyway

This server module takes a UK postcode and validates it against postcodes.io returning true if valid (exists).
It also reformats the entry returning it in upper case with spaced and unspaced postcode versions.
install through the project manager.

The npm is here
https://www.npmjs.com/package/@hyperbytes/wappler-uk-postcode-checker

The module can be found in the "Custom Extensions" folder

Simply add a postcode:

in this example i add the postcode "ne391hq"

The postcode is validated and two correctly formatted versions returned along with a success status indicating the postcode is valid.

{"pc1":{"status":200,"result":true,"postcode_spaced":"NE39 1HQ" ,"postcode_compact":"NE391HQ"}}

which is available in the picker

An invalid postcode returns status 403, false and empty postcode values
{"status":403,"result":false,"postcode_spaced":"","postcode_compact":""}

Any questions, you know where i am

2 Likes