Postal Code API

An API that allows searching in Switzerlands Postal Codes

Features

  • Caches Responses for 30 Minutes
  • Compresses Responses with GZIP
  • Fast JSON-Encoding

Env Vars

  • DB_CONN
  • CACHE_DURATION - in Minutes

Run Locally

air

Generate Documentation (Swagger)

Run this command

swag init

Problems in ASDF

RUn this first

asdf reshim

Build Docker Image Locally

docker build -t plz-api .

Run the Image

Database needs to be running!

docker run --rm -p 3000:3000 --name plz_api -e DB_CONN="<DB_CONN>" plz-api

Todo

  • Consider upping the time data stays in cache, because source only updates every month... Maybe to 1 Month?
  • ...