Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing property server.views #2713

Closed
vitaliyAtSvarog opened this issue Aug 15, 2015 · 8 comments
Closed

Missing property server.views #2713

vitaliyAtSvarog opened this issue Aug 15, 2015 · 8 comments
Labels
non issue Issue is not a problem or requires changes

Comments

@vitaliyAtSvarog
Copy link

var Hapi = require('hapi');
var server = new Hapi.Server();

server.connection({
    port: cfg.port,
    host: cfg.host,
    routes: {
        cors: true
    }
});

server.views({
    engines: {
        'slm': require('slm')
    },
    basePath: __dirname + '/backend/views',
    compileOptions: {
        basePath: __dirname + '/backend/views',
        useCache: cfg.useCache // disable internal cache - useful for development
    },
    isCached: cfg.useCache // disable hapi view cache
});

then in console write 'node server.js' and get error http://screencast.com/t/TfZQLTbb

see debug

error

@gergoerdosi
Copy link
Contributor

You need to register the vision plugin if you use hapi 9.x.x.

server.register(require('vision'), function (err) {
    if (err) {
        throw err;
    }

    server.views({ ... });

    server.start(function () {
        server.log('info', 'Server running at: ' + server.info.uri);
    });
});

@vitaliyAtSvarog
Copy link
Author

Is that described somewhere in the documentation?
docs

@gergoerdosi
Copy link
Contributor

Not yet, the documentation needs an update.

@vitaliyAtSvarog
Copy link
Author

gergoerdosi thx. You helps me 👍

@AdriVanHoudt
Copy link
Contributor

@vitaliyAtSvarog read #2682

@hueniverse hueniverse added the non issue Issue is not a problem or requires changes label Aug 15, 2015
@dlong500
Copy link

Yeah, the documentation and plugins page really need updating. Even though I specifically read about the breaking changes in the v9.0.0 release notes it still took me a while to figure out what to actually DO to migrate the code. In addition to registering the newly separated plugins, you also have to actually install them via npm (and even then it is somewhat obscure, because the plugin names aren't prefixed with hapi--instead it's just vision and inert). They aren't even listed on the "Plugins" page at the site yet either.

With as rapid as updates are for hapi, wouldn't it be better to have some type of versioned documentation like MySQL? I know that a lot of the coders have more important things to do than update documentation, but it's definitely important. I'd volunteer myself but I'm not an expert at even just using hapi yet...

_EDIT_ When I mentioned versioned documentation, I do realize the API docs are versioned, but it would be useful to have a similar model for other parts of the site like plugins (especially when a particular plugin doesn't even apply or make sense before or after a certain version).

@hueniverse
Copy link
Contributor

This is the first breaking release since last December. I wouldn't call it rapid.

@dlong500
Copy link

Sorry, I didn't mean to imply there are breaking changes all the time. But I'd still call going from version 2.x to 9.x in the past year and a half a fairly rapid pace. Even if changes aren't breaking it could still be somewhat difficult to stay on top of things without really good documentation.

That being said I'd much rather have the type of stellar development that has been going on than to have awesome documentation with a stagnant framework. So thanks for your work.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
non issue Issue is not a problem or requires changes
Projects
None yet
Development

No branches or pull requests

5 participants