gulp-webserver icon indicating copy to clipboard operation
gulp-webserver copied to clipboard

TypeError: res.send is not a function

Open felikf opened this issue 7 years ago • 2 comments

I would like to serve alternative index file in some circumstaces: ("gulp-webserver": "0.9.1")

 middleware: function(req, res, next) {
                if ('/' === req.url) {
                    fs.readFile('index_orig.html', 'utf8', function(err, data) {
                        if (err) throw err;
                        res.send(data);
                    });
                }
            }

But I am getting this error:

C:\Users\felix\project\run-dev.js:36
                        res.send(data);
                            ^

TypeError: res.send is not a function
    at C:\Users\felix\project\run-dev.js:36:29
    at tryToString (fs.js:456:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)

felikf avatar May 05 '17 08:05 felikf

I'm doing the same thing and I'm getting the same issue!

factoidforrest avatar Nov 21 '17 19:11 factoidforrest

i have also issue

rehman22 avatar Jun 09 '18 17:06 rehman22