一般情况下用的是模板引擎,如jade:
res.render(‘detail‘,{ // 使用render() #http://www.expressjs.com.cn/4x/api.html#res.render ???title:‘imooc 详情页‘, ???item:movie})
但是有种情况是,我们想直接返回HTML文件,则:
res.sendFile(__dirname+‘/ind.html‘) // 使用sendFile() #http://www.expressjs.com.cn/4x/api.html#res.sendFile
express 直接返回HTML文件
原文地址:http://www.cnblogs.com/aiyr/p/7699628.html