Golang API running as a Vercel Serverless Function which returns your public IP address
- Homepage
- API - supports the following
accept
headers:application/json
application/protobuf
- defaults to
text/plain
- Required
- Optional
- Node.js and npm for running/deploying with Vercel
- protoc-gen-go for updating the
protobuf
API contract found here
# Clone the repo and enter directory
git clone [email protected]:wafer-bw/whatsmyip.git
cd whatsmyip
# Get Vercel and login
npm i -g vercel
vercel login
# Link project to your vercel account
vercel
If you don't have make
, you can just run the commands found in the Makefile directly
# Run the webpage & API
make run
# Run tests & benchmarks
make test
# Run the API only
make api
# Update coverage badge
make coverage
# Update protobuf API contract
make protoc
# Run benchmarks
make benchmark
# Run formatting
make format
# Run linting
make lint
If you have issues with make protoc
:
go get github.com/golang/protobuf/protoc-gen-go
export PATH=$PATH:$HOME/go/bin
export PATH=$PATH:/usr/local/go/bin