By Sarah Ovresat.
A web app that echoes out latitude and longitude information, given an IPv4 address.
- Clone this repo into a directory.
- Duplicate the
config.json.example
file and rename it toconfig.json
- In config.json, set
maxMind_accountID
andmaxMind_licenseKey
. - Run
docker-compose
build for an initial image. - Once that's done, run
docker-compose up
. You will be able to access the app atlocalhost:3000
- Woo hoo! Now feed it IPv4 addresses. :)
For now, you can test the app manually by typing in input to the input field and submitting it. There is also an API endpoint that can be tested.
Run the web app.
- Type in any string to the input field, and submit.
- Pass: "Not a valid IPv4 address is" is displayed.
- Leave the field empty, and submit.
- Pass: "Not a valid IPv4 address is" is displayed.
- Enter an address without periods.
- Pass: "Not a valid IPv4 address is" is displayed.
- Enter an address with extra numbers.
- Pass: "Not a valid IPv4 address is" is displayed.
- Make the api keys in config.json empty strings, and restart the app.
- Pass: "An account ID and license key are required to use this service." is displayed.
Run the web app.
- Go to http://localhost:yourporthere/ip/
- Pass:
{"error":"No IP address provided."}
is displayed.
- Pass:
- Go to http://localhost:yourporthere/ip/123121
- Pass:
{"error":"Not a valid IPv4 address."}
is displayed.
- Pass:
- Go to http://localhost:3000/ip/104.28.22.115
- Pass:
{"latitude":-82.6763,"longitude":8.7891}
is displayed.
- Pass:
- Make the api keys in config.json empty strings, and restart the app.
- Pass:
{"code":"ACCOUNT_ID_REQUIRED","error":"An account ID and license key are required to use this service."}
is displayed.
- Pass: