Skip to content

Commit

Permalink
fix: adapt for latest hoodie
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Nov 10, 2016
1 parent 3ff9fb3 commit 7f417e2
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
// };
//

var getHoodieServer = require('hoodie');
var hoodie = require('hoodie');
var Hapi = require('hapi');
var url = require('url');
var proxy = require('http-proxy-middleware');

var options = {
port: 4201
};

module.exports = function(app) {

// Log proxy requests
Expand All @@ -26,7 +23,18 @@ module.exports = function(app) {

app.use('/hoodie', proxy({target: 'http://localhost:4201'}));

getHoodieServer(options, function (error, server, config) {
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 4201
});

server.register({
register: hoodie,
options: {
// https://github.com/hoodiehq/hoodie/#hapi-plugin
}
}, function (error) {
if (error) {
var stack = new Error().stack.split('\n').slice(2).join('\n');
return console.log('app', 'Failed to initialise:\n' + stack, error);
Expand All @@ -37,8 +45,8 @@ module.exports = function(app) {
server.start(function () {
console.log('Your Hoodie server has started on ' + url.format({
protocol: 'http',
hostname: config.connection.host,
port: config.connection.port
hostname: 'localhost',
port: 4201
}));
});
});
Expand Down

0 comments on commit 7f417e2

Please sign in to comment.