Express not sending or not reaching route

1.4k views Asked by At

I have a pretty large file base so It is hard to show everything.

I have an express server with some routes, one being POST /set route. Almost every time I try and post something to the server I get no response at all, In fact, The first thing I do in /set is to log a simple hello and it does not appear to even reach the route. I am using the Morgan logger to log requests and this is what it shows: Notice the first few request come through

The first few request go through but not that specific route. as well as other routes work afterward. This happens constantly on this route, but will occasionally happen on other routes and I get an "ERRCONRESET" error whenever this happens. When this happens, if I send the request right away within a few seconds of the first failing it will go through.

Any advice would be greatly appreciated.

enter image description here

There is a lack of code because it is not reaching the route, it might be dropping the connected because of a middleware or something in express but there is no errors being logged. For middlewares I am using "bodyParser", "session", "cookieParser", "helmet", "morgan" "gzip" and "passport". There is also no authentication middle applied to this route.

1

There are 1 answers

4
Getz On

I think express doesn't end you request because you never send anything; so the request time out.

Try to send a simple string instead of doing nothing:

  app.post('/set', (req, res) => {
    res.send('hello');
  });