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

Are view paths relative? #37

Closed
nickpoorman opened this issue Nov 17, 2012 · 1 comment
Closed

Are view paths relative? #37

nickpoorman opened this issue Nov 17, 2012 · 1 comment

Comments

@nickpoorman
Copy link

I've got an express app that loads other express apps as middleware. They all share views in the same directory but the various express apps are in different directories.

Correct me if I'm wrong, but it looks like the views are being loaded by a relative path, instead of where I set them in the master app: app.set("views", __dirname + "/views"); Is that what's happening?

Edit: it looks like it's trying to get a view_dir but it seems to be undefined. var view_dir = options.settings.views;

@nickpoorman
Copy link
Author

I figured it out. Looks like you have to set the view directory in each express app and not just the master app.

var viewPath = path.resolve(__dirname, '..', 'views');
app.set("views", viewPath);
app.set('view engine', 'hbs');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant