The express end response method is one of several ways to go about ending an incoming http request from a client system. The express end method is used for situations in which the request is to just simply be put to an end without sending any data to the client. It is true that the method can be used to send data in the form of a string or buffer to the client, but another response method should be used such as res.send, or res.json that are also at hand in a response object.
For a basic example of the express end response method here is an example that uses the app.all method to just simply end any request with the end method. When using the end method there is no need to pass any argument to it, data can be passed in the form of a string or buffer, but if the express end method is being used that way it might be better to use the send response method rather than the end method.
The end method is great for just simply ending a response and not sending any data. A response must always be made to a client one way or another, and some times it is necessary to just end the request with the current status code.
The use of the express end method does not do anything to change the http status code of the response. When using the end method to end a request the statusCode property can be used to find out the current http status code, and the status response object method can be used as a way to set the desired http status code. The express end response method can then be used to end the request with the set status code.
Although it might not be a good idea to use the end response method to send data to the client, it can be used to send a string or a buffer. However the send response method should be used to do this. In addition using the end response method to send something like an object will result in an error, use the json response method to do this to send an object as JSON.
So then the express end response method is one of several ways to end an http request from a client that is a good choice when no data needs to be sent to the client. For more expressjs related content on this site be sure to check out the main post on expressjs.