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 Hapi = require('hapi'); | |
| var server = new Hapi.Server(); | |
| server.connection({ | |
| port: 3000 | |
| }); | |
| server.register({ | |
| register: require('myplugin'), |
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 Hapi = require('hapi'); | |
| var config = { | |
| dbConnection: 'mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test' | |
| }; | |
| var server = new Hapi.Server({ | |
| app: config | |
| }); |
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 fetch = function (username, next) { | |
| // get tweets from the twitter API | |
| next(null, tweets); | |
| }; | |
| server.method({ | |
| name: 'twitter.fetch', | |
| method fetch | |
| }); |
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 myModule = require('../../../../lib/myModule'); | |
| myModule.doSomething(function (err) { | |
| }); |
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 Car = require('model/Car'); |
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 url = require('url'); | |
| var config = module.exports = {}; | |
| var redisToGoConfig; | |
| config.server = { | |
| host: '0.0.0.0', | |
| port: process.env.PORT || 3000 | |
| }; | |
| // look, a comment in the config file! |
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
| function userModel (options) { | |
| var db; | |
| if (!options.db) { | |
| throw new Error('Options.db is required'); | |
| } | |
| db = options.db; | |
| return { |
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
| function sendAlert (property, value) { | |
| console.log('Sending alert... %s : %s', property, value); | |
| var payload = { | |
| apiKey: '', | |
| message: '' | |
| }; | |
| var options = { | |
| host: 'api.opsgenie.com', |
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
| const heapdump = require('heapdump') | |
| const app = require('koa')() | |
| const router = require('koa-router')() | |
| const log = []; | |
| router.get('/', function *(next) { | |
| log.push(this.headers) | |
| this.body = { | |
| status: 'finding a leak' |
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
| # Logs | |
| logs | |
| *.log | |
| npm-debug.log* | |
| # Runtime data | |
| pids | |
| *.pid | |
| *.seed |