From 5e5f92af830dc4c39de4420ac8effebb3bdd392e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 5 Nov 2017 23:49:32 +0100 Subject: geo service --- index.js | 4 ++++ lib/okgeo/index.js | 30 ++++++++++++++++++++++++++++++ lib/okgeo/package.json | 11 +++++++++++ 3 files changed, 45 insertions(+) create mode 100644 lib/okgeo/index.js create mode 100644 lib/okgeo/package.json diff --git a/index.js b/index.js index 40317f25..6c935a31 100644 --- a/index.js +++ b/index.js @@ -85,6 +85,10 @@ var app = okcms.createApp({ maxbytes: 1024*1024*2, }, + geo: { + lib: require("./lib/okgeo"), + }, + push: { lib: require("./lib/okpush"), // mongodbUrl: "mongodb://localhost/okpush_stone" + '_dev', diff --git a/lib/okgeo/index.js b/lib/okgeo/index.js new file mode 100644 index 00000000..20122ffb --- /dev/null +++ b/lib/okgeo/index.js @@ -0,0 +1,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 diff --git a/lib/okgeo/package.json b/lib/okgeo/package.json new file mode 100644 index 00000000..2b2a47c1 --- /dev/null +++ b/lib/okgeo/package.json @@ -0,0 +1,11 @@ +{ + "name": "okexample", + "version": "1.0.0", + "description": "example service", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "okfocus ", + "license": "LNT" +} -- cgit v1.2.3-70-g09d2