Skip to content
This repository has been archived by the owner on Jun 14, 2019. It is now read-only.

Commit

Permalink
Adjust for new hapi version
Browse files Browse the repository at this point in the history
  • Loading branch information
eljenso committed Dec 4, 2015
1 parent 9c0cfd2 commit f6c7d6c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 26 deletions.
4 changes: 2 additions & 2 deletions modules/socketLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function sendTrack (isCurrent, track) {
io.sockets.emit(broadcastEvent, track);
}

function init(listener) {
io = socketIO(listener);
function init(hapio) {
io = hapio;


io.on('connection', function (socket) {
Expand Down
71 changes: 47 additions & 24 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,56 @@ socket.init(server.listener);
var mopidy = require('./modules/mopidyCom.js');
mopidy.init();
*/

server.views({
engines: {
jade: require('jade')
},
relativeTo: __dirname,
path: 'views',
context: {
website: 'Livid'
// Configure hapi server
server.connection({ port: config.main.port });
var socket;
server.register(require('hapio'), function(err) {
if (err) throw err;
socket = require('./modules/socketLogic.js');
socket.init(server.plugins.hapio.io);
});
// View engine
server.register(require('vision'), function (err) {
if (err) {
throw err;
}
server.views({
engines: {
jade: require('jade')
},
relativeTo: __dirname,
path: 'views',
context: {
website: 'Livid'
}
});
});
// Static files
server.register(require('inert'), function (err) {
if (err) {
throw err;
}
// Static files
server.route({
method: 'GET',
path: '/public/{param*}',
handler: {
directory: {
path: 'public'
}
}
});
});
/*
* Set routes
*/
Expand All @@ -69,20 +106,6 @@ server.route({
}
});

// Static files
server.route({
method: 'GET',
path: '/public/{param*}',
handler: {
directory: {
path: 'public'
}
}
});


// Configure hapi server
server.connection({ port: config.main.port });

server.start(function () {
console.log('Server running at:', server.info.uri);
Expand Down

0 comments on commit f6c7d6c

Please sign in to comment.