Ahmed Ahmed
Ahmed Ahmed

Reputation: 105

JavaScript: res.sendFile is not a function

I'm not sure why I am getting this error. Here is my code. Express was already installed with npm install express --save

var express = require('express');
var app = express();
var fs = require('fs')
var path = require('path');

app.get('/register.html',function(req, res){
  res.sendFile(path.join(__dirname+'/register.html'));
});

var server = app.listen(process.env.PORT, function(){
    console.log("Server is listening...")
})

Upvotes: 3

Views: 1666

Answers (1)

wayofthefuture
wayofthefuture

Reputation: 9445

Update express to 4.8+

npm update express --save

Upvotes: 3

Related Questions