jestergeoip
A Jester web plugin that determines geographic information for each web request via API. Uses sqlite3 for a cache.
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install jestergeoip
choosenim install jestergeoip
git clone https://github.com/JohnAD/jestergeoip
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| jestergeoip | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/JohnAD/jestergeoip |
|---|---|
| Homepage | https://github.com/JohnAD/jestergeoip |
| Registry Source | nimble_official |
README
Introduction to jestergeoip
ver 1.0.1
.. image:: https://raw.githubusercontent.com/yglukhov/nimble-tag/master/nimble.png :height: 34 :width: 131 :alt: nimble :target: https://nimble.directory/pkg/jestergeoip
.. image:: https://repo.support/img/rst-banner.png :height: 34 :width: 131 :alt: repo.support :target: https://repo.support/gh/JohnAD/jestergeoip
This is a plugin for the nim web
framework Jester <https://github.com/dom96/jester>__. It pulls location
information from a database run by GeoJS using the IP address of the current
web request and places it into a JSON document.
The service is currently provided for free from https://www.geojs.io/
HOW TO USE
-
Install this library via nimble (
nimble install jestermmgeoip). -
Include the plugin
location <- getGeoIP("sqlitedbname")at the top of your mainroutesor primaryrouter. This will enable the plugin for the whole web site. -
In every route, the
locationJsonNode variable created by the plugin is available.
EXAMPLE
.. code:: nim
import json
import jesterwithplugins
import jestergeoip
proc namePage(loc: JsonNode): string =
if loc.hasKey("country_code"):
result = "Hello person in " & loc["country_code"].getStr
else:
result = "Hello stranger"
routes:
plugin location <- getGeoIP("geojs.db")
get "/test": # get http://127.0.0.1/test
resp namePage(location)
HOW IT WORKS
When ever a request reaches the jester server, the sqlite db is checked for a legacy answer. If an old entry is found or no entry is found, a live API query is made and saved. The time-to-live for an entry is 30 days.
If an error is encountered during an API lookup, the returned JsonNode will contain key of "error" and a value describing the failure.
The answer is returned as a JsonNode object.
For details about the JsonNode document, visit: https://www.geojs.io/docs/v1/endpoints/geo/
Table Of Contents
Introduction to jestergeoip <https://github.com/JohnAD/jestergeoip>__-
Appendices
A.
jestergeoip Reference <https://github.com/JohnAD/jestergeoip/blob/master/docs/jestergeoip-ref.rst>__