From 3e95602487cc8612b658d15190bb8bdd4cc46957 Mon Sep 17 00:00:00 2001 From: Ricardo Quintas Date: Fri, 27 Jun 2014 15:47:22 +0100 Subject: [PATCH 1/2] added my user id to friday-participants.json --- friday-participants.json | 1 + server.js | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/friday-participants.json b/friday-participants.json index 4b80c8f..2eb1ad7 100644 --- a/friday-participants.json +++ b/friday-participants.json @@ -19,6 +19,7 @@ "hugomota", "pvhee", "marcelombc", + "rdquintas", "jamgomes", "baldasman", "antoniocapelo", diff --git a/server.js b/server.js index 8afaab5..03cc28b 100644 --- a/server.js +++ b/server.js @@ -1,27 +1,28 @@ var Hapi = require('hapi'); var FridayParticipants = require('./friday-participants.json'); -var server = Hapi.createServer('0.0.0.0', 8080); +var server = Hapi.createServer('localhost', 8080); -FridayParticipants.forEach(function (participant) { +FridayParticipants.forEach(function(participant) { - var participantPlugin = require('./lib/plugins/' + participant); - server.pack.register(participantPlugin, function (err) { + var participantPlugin = require('./lib/plugins/' + participant); + console.log('participant: ' + participant); + server.pack.register(participantPlugin, function(err) { - if (err) { - console.error(err); - process.exit(); - } - }); + if (err) { + console.error(err); + process.exit(); + } + }); }); -server.start(function (err) { +server.start(function(err) { - if (err) { - console.error(err); - return; - } + if (err) { + console.error(err); + return; + } - console.log('Server started'); -}); \ No newline at end of file + console.log('Server started'); +}); From 6dfe18c954b5105d766ba3798b738d2639794bb1 Mon Sep 17 00:00:00 2001 From: Ricardo Quintas Date: Fri, 27 Jun 2014 16:09:33 +0100 Subject: [PATCH 2/2] adding rdquintas to user list --- lib/plugins/rdquintas/index.js | 25 +++++++++++++++---------- server.js | 1 - 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/plugins/rdquintas/index.js b/lib/plugins/rdquintas/index.js index c37d3a6..216cb1c 100644 --- a/lib/plugins/rdquintas/index.js +++ b/lib/plugins/rdquintas/index.js @@ -9,18 +9,23 @@ internals.defaults = {}; exports.register = function(plugin, options, next) { - plugin.route({ - method: 'GET', - path: '/rdquintas', - handler: function(request, reply) { - reply('don\'t worry, be hapi!'); - } - }); + plugin.route({ + method: 'GET', + path: '/rdquintas', + handler: function(request, reply) { + // reply('don\'t worry, be hapi!'); + reply.proxy({ + host: 'google.com/search?q=', + port: 80, + protocol: 'http' + }); + } + }); - next(); + next(); }; exports.register.attributes = { - name: 'rdquintas', - version: '0.0.0' + name: 'rdquintas', + version: '0.0.0' }; diff --git a/server.js b/server.js index 03cc28b..3110980 100644 --- a/server.js +++ b/server.js @@ -7,7 +7,6 @@ var server = Hapi.createServer('localhost', 8080); FridayParticipants.forEach(function(participant) { var participantPlugin = require('./lib/plugins/' + participant); - console.log('participant: ' + participant); server.pack.register(participantPlugin, function(err) { if (err) {