问个低级问题,关于res.send和res.end
很多时候,大家都再说res.end 必须要在res.send后加上,不然客户端会一直等待回应?
但是我们在写代码的时候,很多时候直接,res.send();并没有加end,也没事.这是为什么?
以下是官方文档说明: res.end([data] [, encoding]) Ends the response process. This method actually comes from Node core, specifically the response.end() method of http.ServerResponse.
Use to quickly end the response without any data. If you need to respond with data, instead use methods such as res.send() and res.json().
说明里也并没有强调一定要写一个res.end