This file contains hidden or 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
| exports.register = function (plugin, options, next) { | |
| plugin.route({ | |
| method: 'get', | |
| path: '/', | |
| handler: function (request, reply) { | |
| reply('hello, world'); | |
| } | |
| }); | |
| next(); |
This file contains hidden or 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
| config: { | |
| validate: { | |
| payload: Joi.object().keys({ | |
| state: Joi.string(), | |
| county: Joi.string(), | |
| city: Joi.string(), | |
| zip: Joi.number().integer() | |
| }).with('county', 'state').with('city', 'state').without('state', 'zip').without('county', 'city') | |
| } | |
| } |
This file contains hidden or 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
| exports.index = function (request, reply) { | |
| reply('hello world'); | |
| }; |
This file contains hidden or 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 levelup = require('levelup'); | |
| var riakdown = require('riakdown'); | |
| var concat = require('concat-stream'); | |
| var db = levelup('riak://localhost:8087/default', {db: riakdown, valueEncoding: 'json'}); | |
| db.put('testkey', '{"name": "ham"}', {indexes: [{key: 'name_bin', value: 'ham'}], bucket: 'default'}, function (err, extra) { | |
| db.createReadStream({ | |
| index: 'name_bin', | |
| start: 'ham', |
This file contains hidden or 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
| 100 | |
| 1234 | |
| +1 | |
| -1 | |
| 8ball | |
| abc | |
| abcd | |
| atm | |
| bangbang | |
| busstop |
This file contains hidden or 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
| [ | |
| {riak_api, [ | |
| {certfile, "/usr/local/Cellar/riak/2.0.0-beta1/libexec/etc/cert.pem"}, | |
| {keyfile, "/usr/local/Cellar/riak/2.0.0-beta1/libexec/etc/key.pem"} | |
| ]} | |
| ]. |
This file contains hidden or 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 defaults = { | |
| something: 'data' | |
| } | |
| server.ext('onPreResponse', function (request, reply) { | |
| if (request.response.variety === 'view') { | |
| request.response.source.context = Hoek.applyToDefaults(defaults, request.response.source.context); | |
| } | |
| reply(); |
This file contains hidden or 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
| server.route({ | |
| method: 'get', | |
| path: '/some/proxy', | |
| handler: function (request, reply) { | |
| request.query.something = 'whatever_static_value'; | |
| reply.proxy({ | |
| uri: 'http://some.upstream', | |
| onResponse: function (err, res, request, reply, settings, ttl) { |
This file contains hidden or 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 handler = function (request, reply) { | |
| // this = { isRoot: true } | |
| }; | |
| server.route({ | |
| method: 'GET', | |
| path: '/', | |
| handler: handler, | |
| config: { | |
| bind: { |
This file contains hidden or 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 verymodel = require('verymodel'); | |
| var VeryModel = verymodel.VeryModel; | |
| var VeryCollection = verymodel.VeryCollection; | |
| var Tour = new VeryModel({ | |
| name: {} | |
| }); | |
| // with a collection | |
| var Tours = new VeryCollection(Tour); |