hapi
hapi copied to clipboard
Blank screen when trying to upgrade to hapi 9.3.1
This may be a stupid error, but I am having problems migrating hapi from ~6 to 9.3.1. It seems like the changes are mainly in the plugin area inert, vision, and h2o2. This is just a snippet from my server. I get a blank white screen when I try set this up, any ideas/help? I get 200 responses and no errors anywhere when I run this code as well. Thanks!
var server = new Hapi.Server();
server.connection({port: port});
server.register([
require('vision'),
require('inert'),
require('h2o2')], function(error) {
if (error) {
console.log('Plugin load failed: ' + error);
}
server.views({
engines: {
html: require('handlebars')
},
path: Path.join(__dirname, './backend/views')
});
server.route({
method: 'GET',
path: '/login',
handler: function(request, reply) {
if (isLoggedIn(request)) {
reply.redirect('/');
}
} else {
var viewOpts = {};
reply.view('login', viewOpts);
}
}
});
});
Your code works for me. https://github.com/nlindley/hapi-vision-test
Can't really help with this. You can try opening an issue on hapijs/discuss and provide more information.