Express Generator Without Jade

后端 未结 6 1274
南方客
南方客 2021-02-07 03:46

I am trying to generate an express skeleton, using the express generator. So it would be this:

$ npm install express-generator -g

However, it

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 04:04

    This generator seems to handle EJS templates. EJS is just HTML with the ability to insert variables. Well... Like a templating engine. But EJS is also the rendering engine for HTML.

    In the app.js of the generator you can see this line (15):

    app.set('view engine', '{views}');
    

    So my guess is that if you select the EJS engine when installing, it will be good. As long as you put your html files in the specified folder (line 14, app.js):

    app.set('views', path.join(__dirname, 'views'));
    

提交回复
热议问题