How does node configure multiple views directories?

  node.js, question

The topic may not be clear, the previous figure:
图片描述

The configuration in the red box simply sets theviewsAs a directory for dynamic rendering templates, it can only be accessedviewsThe pages under the folder now need to be in theviewsSet up multiple folders below, such as:
图片描述

Now not only to visitplan_detail.htmlAndsale_net.htmlBut also accessproject1Andproject2Page in.
For example, visitplan_detail.htmlThe address bar is directlylocalhost:3000/plan_detail
Accessproject1The page in islocalhost:3000/project1/pageName
Master file (index.js) How should inside revise?

The main file code is attached below:

var express = require('express');
 var exphbs = require('express-handlebars');
 var path = require('path');
 var app = express();
 
 app.engine('.html', exphbs({
 partialsDir:'views/include',
 extname: '.html'
 }));
 
 app.set('views','./views');
 app.set('view engine', '.html');
 
 app.use(express.static(path.join(__dirname,'public')));
 
 app.all('*', function (req, res) {
 res.render(req.url.split('/')[1]);
 });
 
 app.listen(3000);

This views inside refers to templates, not pages you understand.

Localhost: 3000/project1/pagename access the mapping of the server to be built.

app.get(“/project1/pageName”,function(req,res){

//

});

The template of views inside is in RES. Render (‘pagename’,’ XXX: XXX}). Used as a key;