Node/Express.js - Overriding where to look for the 'Views' folder for each request

后端 未结 3 1750
南笙
南笙 2021-02-03 23:18

In my Node/Express.js project I can set the views folder globally like so:

app.configure(function() {
    app.set(\'views\', __dirname + \'/views\');
    .... sn         


        
3条回答
  •  孤城傲影
    2021-02-03 23:59

    Full path works too

    app.get('/', function(req, res) {
        res.render(path.join(__dirname, 'view.jade'));
    });
    

提交回复
热议问题