https://github.com/pieropatron/demo_geo_proxy
proxy services for Nominatim, OSRM, GeoTZ
https://github.com/pieropatron/demo_geo_proxy
basic-authentication cache expressjs geo-tz jwt node-cluster nominatim osrm redis
Last synced: about 1 year ago
JSON representation
proxy services for Nominatim, OSRM, GeoTZ
- Host: GitHub
- URL: https://github.com/pieropatron/demo_geo_proxy
- Owner: pieropatron
- License: mit
- Created: 2023-06-05T09:57:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-09T06:36:14.000Z (almost 3 years ago)
- Last Synced: 2025-01-06T22:52:35.634Z (about 1 year ago)
- Topics: basic-authentication, cache, expressjs, geo-tz, jwt, node-cluster, nominatim, osrm, redis
- Language: TypeScript
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# demo_geo_proxy
Demo project for create proxy server to get geo data from OSM API's (Nominatim, OSRM) and for get information about timezone by location.
SometimesProblems, which project suppose to solve:
1. As I know, Nominatim and OSRM doesn't have authorization "out of the box". Also, they haven't built-in cache. This service allows to use Basic and JWT authorization and Cache, based on Redis.
2. Geo-tz (https://github.com/evansiroky/node-geo-tz) is a beautiful tool for get information regarding IANA timezones by geo locations. But, as it has a lot of data and requires periodical updates of timezones settings, it is not comfortable to have it imported to the project, which is supposed to be used even at few of servers. Instead of that, in my opinion, better to have single server with RESTAPI to get this information. This should allow actualize tz data only for this server and to avoid dependency from this lib for another projects.
# Installation:
``` bash
git clone https://github.com/pieropatron/demo_geo_proxy
npm install
```
For work service uses configuration files. After install, please, create file "local-config.js" at dist folder and fill it with following options:
``` ts
exports.default = {
restapi: {
port: 3000, // port of appication
worker_count: 0 // amount of cluster workers
},
// settings for Basic Auth
basic_auth: {
user: 'user',
pass: 'pass'
},
// settings for JWT authorization
jwt_auth: {
key: 'key',
iss: 'iss',
expires: '1m'
},
redis: {
// url for redis client
url: "redis://127.0.0.1:6379/0",
// time-to-live of cached responses, in seconds
ttl_seconds: 60
},
nominatim: {
// base url for Nominatim
url: "https://nominatim.openstreetmap.org/"
},
osrm: {
// base url for OSRM
url: "http://router.project-osrm.org/"
}
};
```
NB: At example above you can see default values of options
# Start
After that, service could be started by:
``` bash
npm start
```
If you need to generate JWT token with TTL for 3 year, you can use following command:
``` bash
npm run jwt
```