From 95df0e83fdb7f564d64b6c916e674e0db46c116d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 4 Oct 2016 19:50:38 -0400 Subject: starting push notification module --- examples/lib/okpush/index.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 examples/lib/okpush/index.js (limited to 'examples/lib/okpush/index.js') diff --git a/examples/lib/okpush/index.js b/examples/lib/okpush/index.js new file mode 100644 index 0000000..8b10918 --- /dev/null +++ b/examples/lib/okpush/index.js @@ -0,0 +1,34 @@ +/** + */ + +var apn = require('apn'); + +function OKPush (options) { + if (!(this instanceof OKPush)) return new OKPush(options) + options = options || {} + if (!options.express) + throw new Error('Express not provided to OKPush'); + if (!options.config) + throw new Error('Configuration not provided to OKPush'); + + var express = options.express + var router = express.Router() + var config = options.config + var db = options.db + + router.get('*', function (req, res) { + res.send(config.stuff) + }) + + router.post('*', function (req, res) { + throw new Error('OKPush POST requests not implemented') + }) + + this._router = router +} + +OKExample.prototype.middleware = function () { + return this._router +} + +module.exports = OKExample -- cgit v1.2.3-70-g09d2