diff options
Diffstat (limited to 'examples/lib/okpush/index.js')
| -rw-r--r-- | examples/lib/okpush/index.js | 34 |
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 |
