node-provision
Description
node-provision is a node middleware that analyze http request.
it can detect followings:
- language
- country
- geo location
- browser type (mobile, tablet, desktop)
Dependencies
Installation
see geoip.
- Install libGeoIP shared libraries.
- Download GeoLiteCity.dat and place it in /usr/local/share/GeoIP (see note below on file placement).
next,
npm install provision
Usage
var provision = ;...app;
you can configure options and functions.
provisionoptions =monomi: trueuseragent: truegeoip: truelanguage: true;provision;
provision data below:
{ location:
{ country_code: 'US',
country_code3: 'USA',
country_name: 'United States',
region: 'CA',
city: 'Mountain View',
postal_code: '94043',
latitude: 37.4192008972168,
longitude: -122.05740356445312,
metro_code: 807,
dma_code: 807,
area_code: 650,
continent_code: 'NA' },
country: 'us',
language: 'ko',
browserType: 'desktop',
family: 'Chrome',
os: 'Mac OS X',
osVersion: '15' }
Run the tests
npm test