summaryrefslogtreecommitdiff
path: root/examples/lib/okpush/index.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-10-04 19:50:38 -0400
committerJules Laplace <jules@okfoc.us>2016-10-04 19:50:38 -0400
commit95df0e83fdb7f564d64b6c916e674e0db46c116d (patch)
treeb0e68ea99a5a57fdb95aa1046db8fe69d0aefbbb /examples/lib/okpush/index.js
parent7e525bc4ae191bde7cb40de2c489250cb3e0af0f (diff)
starting push notification module
Diffstat (limited to 'examples/lib/okpush/index.js')
-rw-r--r--examples/lib/okpush/index.js34
1 files changed, 34 insertions, 0 deletions
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