Node.js Express API request hangs indefinitely (no response, no error) after previously working [closed]

1 day ago 1
ARTICLE AD BOX

I’m facing an issue with my Node.js + Express application where a very basic API endpoint (a simple /ping route) was working fine earlier, but now it suddenly hangs when I hit it from Postman.

The request stays in a “processing” state indefinitely — it neither returns a success response nor fails with an error.


Setup:

Node.js (v16)

Express

Using middleware like body-parser, cookie-parser, response-time

Sequelize (MySQL) for DB connection


Server Code (simplified):

const express = require("express"); const bodyParser = require("body-parser"); const responseTime = require("response-time"); const cookieParser = require("cookie-parser"); const app = express(); app.use(cookieParser()); app.use(responseTime()); app.use(bodyParser.json()); app.use(bodyParser.text()); app.use(bodyParser.urlencoded({ extended: true })); app.get("/ping", (req, res) => { console.log("Ping hit"); res.send("pong"); }); app.listen(3000, async () => { console.log("Server started"); // DB sync await db.sync(); });

Problem:

When I hit:

GET http://localhost:3000/ping

Postman keeps loading indefinitely

No response is returned

No error is shown in the console

Sometimes I also see:

[nodemon] clean exit - waiting for changes before restart

What I’ve Tried:

Verified that the route exists and is correct

Added console logs inside the route (sometimes not printed)

Checked port conflicts using lsof -i :3000

Restarted the server

Tried using curl instead of Postman — still hangs

Checked middleware for missing next()


Expected Behavior:

The /ping route should immediately return:

pong

Actual Behavior:

The request hangs indefinitely with no response or error.


Questions:

What could cause an Express route to hang like this without throwing any error?

Can placing async logic (like await db.sync()) inside app.listen() cause such issues?

Are there common middleware or configuration mistakes that can block the request lifecycle?


Any guidance or debugging strategies would be really helpful. Thanks!

Read Entire Article