/whatsmyip

Golang API deployed as a Vercel Serverless Function that returns your public IP address.

Primary LanguageGoMIT LicenseMIT

whatsmyip

Golang API running as a Vercel Serverless Function which returns your public IP address

Links

  • Homepage
  • API - supports the following accept headers:
    • application/json
    • application/protobuf
    • defaults to text/plain

Prerequisites

Setup

# Clone the repo and enter directory
git clone git@github.com:wafer-bw/whatsmyip.git
cd whatsmyip
# Get Vercel and login
npm i -g vercel
vercel login
# Link project to your vercel account
vercel

Usage

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