Node Js (express) server responds to requests via cUrl, but gives infinite load when requested via Postman or browser. There are no errors
Found similar tracks, but none of them helped me.
Can you tell me what this might be related to?
Express js
const app = express();
app.use(cors());
app.use(express.json());
app.use(express.static(path.resolve(__dirname, 'static')))
app.use(fileUpload({}))
app.use('/api', router)
app.use(errorHandler)
const start = async () => {
try {
await sequelize.authenticate();
await sequelize.sync();
app.listen(PORT, () => {
console.log(`Server started on port ${PORT}`);
});
} catch (e) {
console.log(e);
}
};
start();
//curl request (Empty array response, because bd is empty)
root@fnrnacxqna:~# curl http://5.35.95.237:5000/api/client
[]root@fnrnacxqna:~#
// server reaction (Pretty sure this is useless information, but still)
Executing (default): SELECT "id", "name", "img", "createdAt", "updatedAt" FROM "clients" AS "client";
//connection check
root@fnrnacxqna:~# sudo lsof -i -P -n | grep LISTEN
systemd-r 3733 systemd-resolve 14u IPv4 35965 0t0 TCP 127.0.0.53:53 (LISTEN)
sshd 13689 root 3u IPv4 44183 0t0 TCP *:22 (LISTEN)
sshd 13689 root 4u IPv6 44194 0t0 TCP *:22 (LISTEN)
nginx 25349 root 6u IPv4 88138 0t0 TCP *:80 (LISTEN)
nginx 25349 root 7u IPv6 88139 0t0 TCP *:80 (LISTEN)
nginx 25350 www-data 6u IPv4 88138 0t0 TCP *:80 (LISTEN)
nginx 25350 www-data 7u IPv6 88139 0t0 TCP *:80 (LISTEN)
postgres 31592 postgres 5u IPv4 128205 0t0 TCP *:5432 (LISTEN)
postgres 31592 postgres 6u IPv6 128206 0t0 TCP *:5432 (LISTEN)
node 33352 root 24u IPv6 139994 0t0 TCP *:5000 (LISTEN)
root@fnrnacxqna:~#
Following advice from other posts, tried changing the Postman settings, but nothing helped.
2
Answers
Thanks everyone, I just needed to disable the firewall
-sudo ufw disable
Have you used cURL on the same VPS server?
If so, you might need to enable access to port 5000 to access it externally from outside the VPS server.