'use strict';

// Load modules
var Hapi = require('hapi');
var mongoose = require('mongoose');

// Create a server instance
var server = new Hapi.Server();
server.connection({ port: 3000 });

// Attach the routes
server.route(require('./routes'));

// Connect to mongoDB
mongoose.connect('mongodb://localhost/intelliroads');
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function callback() {
  console.log('Connection with database succeeded');
});

// Fire up the server
server.start(function () {
  console.log('Server running at:', server.info.uri);
});

@@ -192,62 +192,296 @@
 %0A// 
-Attach the routes%0Aserver.route(require('./routes'));%0A%0A
+Register plugins%0Aserver.register(%5B%0A  %7B%0A    register: require('good'),%0A    options: %7B%0A      reporters: %5B%0A        %7B%0A          reporter: require('good-console'),%0A          events: %7B log: '*', response: '*' %7D%0A        %7D%0A      %5D%0A    %7D%0A  %7D%0A%5D, function (err) %7B%0A  if (err) %7B%0A    throw err;%0A  %7D%0A%0A  
 // C
@@ -498,16 +498,18 @@
 mongoDB%0A
+  
 mongoose
@@ -550,24 +550,26 @@
 lliroads');%0A
+  
 var db = mon
@@ -586,16 +586,18 @@
 ection;%0A
+  
 db.on('e
@@ -607,38 +607,48 @@
 r', 
-console.error.bind(console, 'c
+function () %7B%0A    server.log('error', 'C
 onne
@@ -661,19 +661,26 @@
 error:')
+;%0A  %7D
 );%0A
+  
 db.once(
@@ -700,35 +700,36 @@
 ion 
-callback() %7B%0A  console.log(
+() %7B%0A    server.log('info', 
 'Con
@@ -767,23 +767,86 @@
 ');%0A
+  
 %7D);%0A%0A
+  
 // 
-Fire up
+Attach the routes%0A  server.route(require('./routes'));%0A%0A  // Start
  the
@@ -853,16 +853,18 @@
  server%0A
+  
 server.s
@@ -888,20 +888,29 @@
 %7B%0A  
-console.log(
+  server.log('info', 
 'Ser
@@ -924,18 +924,20 @@
 ning at:
-',
+ ' +
  server.
@@ -947,12 +947,18 @@
 o.uri);%0A
+  %7D);%0A
 %7D);%0A

Add good logger