user4445419
user4445419

Reputation:

Express doesnt send the end response

Im having nodeJS app with express 4.13.0, when I run requests from postman the process has invoked but I dont get status successful (200)or any status , I see that the code was invoked (I got the console message)

            console.log("Project replaced successfully ");
            res.end("Replaced successfully ", 200);

I try even with just

res.end(200) and I still see that the postman is processing, what could be the reason?

Upvotes: 0

Views: 78

Answers (1)

Shanoor
Shanoor

Reputation: 13662

According to the docs, res.end() doesn't accept a status code and you should not use it if you send back data, use res.send() instead. By default, the status code is 200, if you need a different one, write something like this res.status(404).send('hello').

Upvotes: 1

Related Questions