nodejs如何调用.html
发布于 9 年前 作者 im-here 4413 次浏览 最后一次编辑是 8 年前 来自 问答

假如目前项目模板用jade,现在我想某一个地方要调用html页面怎么实现呢,直接用render(‘xx.html’)发现不行。

5 回复

var fs = require(‘fs’) res.setHeader(‘content-type’, ‘text/html’); res.send(fs.readFilesync(path)); res.end();

@MiguelValentine 这是把这个html当文本读出来,再渲染出来是吧

@imhered 不需要渲染,html直接输出

@imhered readFileSync 我大小写打错了。盲打的

回到顶部