Created
June 27, 2014 02:13
-
-
Save gatorcse/90969475ff3bba0c2eb6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Hoek = require('Hoek') | |
var defaults = {} | |
exports.register = function (plugin, options, next) { | |
options = Hoek.applyToDefaults(defaults, options) | |
plugin.route({ | |
path: '/foo', | |
method: 'GET', | |
handler: function (request, reply) { | |
var db = request.server.plugins['hapi-mongodb'].db | |
var stream = db.collection('foo') | |
.find({}) | |
.stream() | |
reply(stream) | |
} | |
}) | |
next() | |
} | |
exports.register.attributes = { | |
pkg: require('./package.json') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment