jedireza / hapi-react-views

:package: A hapi view engine for React components
MIT License
231 stars 33 forks source link

Broken with v9 #20

Closed hydrotik closed 9 years ago

hydrotik commented 9 years ago

https://github.com/hapijs/hapi/issues/2706

jedireza commented 9 years ago

Thanks for creating an issue. We definitely need to make some doc updates for hapi 9.

One thing you'll need to include in your project is a vision plugin. vision is what decorates server with a views method in hapi 9.

hydrotik commented 9 years ago

Yes, I was able to track down to that and got everything working with this code:


var rootHandler = function (request, reply) {
    reply.view('Default');
};

server.register(require('vision'), function (err) {

    server.views({
        engines: {
            jsx: require('hapi-react-views')
        },
        relativeTo: __dirname,
        path: 'views'
    });
    // Add main app route
    server.route({
      method: 'GET',
      path: '/',
      handler: rootHandler
    });

    server.start(function() {
      console.log(dateFormat(new Date(), format) + ' - Server started at: ' + server.info.uri);
    });
});

Thanks for the quick heads up!

jedireza commented 9 years ago

Nice. I opened #21 as a reminder to update the README docs and links for this repo.