在羽毛中使用Nunjucks

时间:2016-09-12 20:01:32

标签: node.js feathersjs

我有一个Feathers应用程序。本周末,我决定将应用程序从Swig迁移到Nunjucks。为了做到这一点,我在./routes/index.js文件中有以下内容:

'use strict';

module.exports = function() {
    const app = this;
    const path = require('path');
    const nunjucks = require('nunjucks');    
    const home = require('./home');

    nunjucks.configure('views', {
        express : app,
        noCache : app.get('env') === 'development',
    });

    app.set('views', path.join(__dirname, '../views'));
    app.set('view engine', 'html');    

    // Configure the routes.
    app.configure(home);
};

My Feathers应用程序启动正常。但是,当我导航到主页时,我被重定向到./auth/failure屏幕并收到“登录失败”错误。请记住,当我使用Swig时,这很好用。所以,我决定用最基本的HTML替换我的观点:

<!DOCTYPE html>
<html>
<body>

<h1>Hello</h1>

</body>
</html>

所以,我知道模板引擎本身没有任何东西。它与它在运行时的使用方式有关。然而,我无法弄清楚如何获得更详细的错误消息以了解导致错误的原因。

如何在我的Feathers应用程序中使用Nunjucks代替Swig?

0 个答案:

没有答案
相关问题