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

express 环境下的实例写得有问题,请教该如何配置? #7

Open
shibazijun opened this issue Nov 6, 2018 · 0 comments

Comments

@shibazijun
Copy link

express 环境下的实例写得有问题,希望能够完善一下。
我按文档配置模板引擎代码下
app.engine('art', require('express-art-template'));
app.set('view options', {
debug: process.env.NODE_ENV !== 'production'
});
报错:
(node:11512) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: No default engine was specified and no extension was provided.
(node:11512) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:11512) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: No default engine was specified and no extension was provided.

一定要用以下方式才可以生效
app.engine('.html', require('express-art-template'));
app.set('view engine', 'html');

但这样配置我不明白参数如何配置?按照你提供的文档配置似乎没有生效,还有如何自定义自己的过滤器?
app.set('view options', {
debug: process.env.NODE_ENV !== 'production'
});

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