summaryrefslogtreecommitdiff
path: root/lib/okgeo/index.js
blob: 20122ffb5a15b0b182beb35bf07a1ce04eb54435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * This service dumps the headers in hopes the country code will be there.
 */

function OKGeo (options) {
  if (!(this instanceof OKGeo)) return new OKGeo(options)
  options = options || {}
  if (!options.express)
    throw new Error('Express not provided to OKGeo');
  if (!options.config)
    throw new Error('Configuration not provided to OKGeo');

  var express = options.express
  var router = express.Router()
  var config = options.config
  var db = options.db

  router.get('*', function (req, res) {
    res.send(req.headers)
  })

  this._router = router
}

OKGeo.prototype.middleware = function () {
  return this._router
}

module.exports = OKGeo