This provides a stub server for the post code anywhere api.
The service can be run inside a docker container.
You will need docker installed
Build the docker image.
docker build -t postcode-anywhere-stub .
Run the docker image
docker run -it --detach -p 127.0.0.1:9040:9040 --name postcode-anywhere-stub postcode-anywhere-stub
Open in a browser https://localhost:9040/
and add an exception for the ssl key.
brew install go
export GOPATH=$HOME/go
Clone the service into a new directory
mkdir ~/go/src/github.com/thomaslorentsen/
cd ~/go/src/github.com/thomaslorentsen/
git clone git@github.com:thomaslorentsen/postcode-anywhere-stub.git
Generate the SSL keys needed to run over https
mkdir -p ~/go/bin/
cd ~/go/bin/
openssl genrsa -out server.key 2048
openssl req -new -x509 -sha256 -key server.key -out server.pem -days 3650
You can use go to fetch and compile the source for you with the following command:
go get github.com/thomaslorentsen/postcode-anywhere-stub
The server will then be installed
Compile the source
go install github.com/thomaslorentsen/postcode-anywhere-stub
Run the server located in the bin folder
$GOPATH/bin/postcode-anywhere-stub
Once Post Code Anywhere has been initiated, the host can be set to use the stub server. In the browser console run:
pca.host = 'localhost:9040'
The ssl certificate and key can be set with
./postcode-anywhere-stub -cert server.pem -key server.key
The port that the server binds to can be set with
./postcode-anywhere-stub -port 9040