How to set multiple views folder in Express.js app

蹲街弑〆低调 提交于 2021-02-11 13:28:48

问题


When I have one views folder specified it will serve files, but when I specify a second alongside it does not work. I have tried numerous things, to no avail. Here is my code:

app.use(express.static('views'));

//app.set('views', [__dirname + '/views', __dirname + '/views/views2']);

app.use("/views", express.static(__dirname + "/views"));

app.use("/views2", express.static(__dirname + "/views2"));

The app.set doesn't work at all and so I commented it out here, and the last two lines are not working either.

来源:https://stackoverflow.com/questions/64625507/how-to-set-multiple-views-folder-in-express-js-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!