Serverscript returns 404 nodejs, while file exists

Viewed 14

Coming from a PHP world I'm facing a learning curve to get my simple, yet required, NodeJS server script up and running. I'm using pm2 to ensure the script runs. I've added a logging mechanism to keep myself informed with heartbeats and other connection related diagnostics. This all works fine.

However, the NodeJS script is also able to accept two POST requests. When I make a POST request to that endpoint with port number I get a 404. When I make a POST request to that endpoint without the port, the plain javascript is returned.

So, when I use Postman to see what's happening:

POST to https://subdomain.mydomain.com/main.js:8080 => 404
POST to https://subdomain.mydomain.com/main.js => plain js source

Among other implementation code, this the piece that creates the webserver (pretty straight forward).

server = http.createServer(requestListener);
server.listen(8080);

I'm not sure what I'm doing wrong. Maybe its something obvious, but on my local environment I got the POST requests working just fine.

0 Answers
Related