Skip to content

Instantly share code, notes, and snippets.

@gatorcse
Created June 27, 2014 02:13
Show Gist options
  • Save gatorcse/90969475ff3bba0c2eb6 to your computer and use it in GitHub Desktop.
Save gatorcse/90969475ff3bba0c2eb6 to your computer and use it in GitHub Desktop.
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