Home > OS >  Express server always loading and not sent any response
Express server always loading and not sent any response

Time:11-25

I've running my express server and there is no log error. But when I hit the API I create with express, it just loading eternally. It is not about that I forgot to send the response with res.send() or res.json(). All of that is fine. This server was running properly before. And when my computer suddenly lagging, and I kill my all node. This happened.

I've tried to restart, shutdown, and kill all node with

sudo killall node

Or

sudo kill -9 `ps aux | grep node | grep -v grep | awk '{print $2}'`

But still it doesn't work. I have no idea how to debug this either, so if there is some information about my problem that you guys need me to provide please tell me.

And btw when I run a simple node.js script it just run well.

enter image description here

CodePudding user response:

Turns out there is the problem on my middleware function.

const session = require('./middlewares/session');
...

app.use(session); /* --> should be app.use(session()) */

I call the middleware with session because previously I used express-session library which it put the middleware like a variable.

But still, there is no a single error, neither in the log or the client itself. It'll be so hard to trace.

  • Related