Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions friday-participants.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
"joaquimserafim",
"nunoveloso",
"satazor",
"johnbrett",
"andrefs",
"davecocoa",
"pedrocarrico",
"paulovieira",
"taterbase",
"filipediasferreira",
"KidkArolis",
"dymonaz",
"marcooliveira",
"rjsmelo",
"miguelampereira",
"zkiiito",
"balazsgabor",
"hugomota",
"pvhee",
"marcelombc",
"jamgomes",
"baldasman",
"antoniocapelo",
"ana-rodrigues",
"suprememoocow",
"davidfoliveira",
"pmarques",
"gergelyke",
"anarcastanho",
"trenpixster"
]
35 changes: 35 additions & 0 deletions lib/plugins/trenpixster/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';

// Declare internals
var internals = {};

// Defaults
internals.defaults = {};
var mapper = function(request, callback) {
callback(null, "http://trenpixster.github.io/");
}
var handler = { proxy: { mapUri: mapper } };

exports.register = function(plugin, options, next) {

plugin.route({
method: 'GET',
path: '/trenpixster',
handler: function(request, reply) {
reply('don\'t worry, be hapi!');
}
});

plugin.route({
method: 'GET',
path: '/trenpixster-proxy',
handler: handler
});

next();
};

exports.register.attributes = {
name: 'trenpixster',
version: '0.0.0'
};
5 changes: 3 additions & 2 deletions participants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var fs = require('fs');
var participants = [
var participants = [
'joaquimserafim',
'nunoveloso',
'satazor',
Expand Down Expand Up @@ -56,7 +56,8 @@ var participants = [
'catarinamoura',
'yrezgui',
'pmiguelrn',
'nihildacta'
'nihildacta',
'trenpixster'
];

// var saturday = [
Expand Down
5 changes: 3 additions & 2 deletions participants.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
[
"joaquimserafim",
"nunoveloso",
"satazor",
Expand Down Expand Up @@ -55,5 +55,6 @@
"catarinamoura",
"yrezgui",
"pmiguelrn",
"nihildacta"
"nihildacta",
"trenpixster"
]
53 changes: 53 additions & 0 deletions test/plugins/trenpixster/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict';

var Lab = require('lab'),
Hapi = require('hapi'),
Plugin = require('../../../lib/plugins/trenpixster');

var describe = Lab.experiment;
var it = Lab.test;
var expect = Lab.expect;
var before = Lab.before;
var after = Lab.after;

describe('trenpixster', function() {
var server = new Hapi.Server();
it('Plugin successfully loads', function(done) {
server.pack.register(Plugin, function(err) {

expect(err).to.not.exist;

done();
});
});

it('Plugin registers routes', function(done) {
var table = server.table();

expect(table).to.have.length(2);
expect(table[0].path).to.equal('/trenpixster');
expect(table[1].path).to.equal('/trenpixster-proxy');

done();
});

it('Plugin route responses', function(done) {
var table = server.table();

expect(table).to.have.length(2);
expect(table[0].path).to.equal('/trenpixster');
expect(table[1].path).to.equal('/trenpixster-proxy');

var request = {
method: 'GET',
url: '/trenpixster-proxy'
};

server.inject(request, function(res) {
expect(res.statusCode).to.equal(200);
expect(res.result).to.contain('trenpixster');
done();
});

});
});