Nodejs: Error: Cannot find module 'html'

后端 未结 3 1626
生来不讨喜
生来不讨喜 2021-02-01 22:12

im using nodejs and im trying to serve only html files (no jade, ejs ... engines).

heres my entry point (index.js) code:

var express = require(\'express         


        
3条回答
  •  眼角桃花
    2021-02-01 22:29

    Use render only when using a rendering engines like jade or ejs. If you want to use plain HTML, place it in the public folder or serve it as a static file.

    res.sendFile('index2.html', {root : __dirname + '/views'});
    

提交回复
热议问题