我正在学习基础的MEAN教程,但是遇到了问题。出现了“TypeError: res.sendFile is not a function”的错误。
//package.json
{
"name": "http-server",
"main": "server.js",
"dependencies": {
"express": "^4.13.4"
}
}
//server.js
var express = require('express');
var app = express();
var path = require('path');
app.get('/', function (res, req) {
res.sendFile(path.join(__dirname + '/index.html'));
});
app.listen(1337);
console.log('Visit me at http://localhost:1337');