Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
Why is my Remote Server not appropriately routing?

I am having trouble getting my VPS server set up appropriately. I copied all the files recursively from my local server to the remote server, but post & get requests to the server are not functioning appropriately (404 not found error). The routing works perfectly on my localhost server, but unfortunately it doesn't on the remote.

Server Code:

// getting datastores
const datastore = require('nedb');
const customerRecordsdb = new datastore("CustomerRecords.db");
customerRecordsdb.loadDatabase();

// importing express
const port        = 3000;
const express     = require('express');
const application = express();
const path        = require('path')
const newPath     = path.join(__dirname + '../../..')

application.listen(port, () => console.log("Listening at " + port));
application.use(express.json( {limit: '1mb'} ));

application.get('/RetrieveCustomerInformation', (request, response) => {
    console.log("SUCCESS!");
    customerRecordsdb.find({}, (error, data) => {
        if (error) {
            response.end();
            return;
        }
        response.json(data);
    })
})

Client Code:

// loading data
let numberRecords = 0;
async function loadClientRecords() {
    const response = await fetch('/RetrieveCustomerInformation');
    const data     = await response.json();

    for (let i = 0; i < data.length; i++) {
        numberRecords++;
        insertNewRecord(data[i]);
    }
}
loadClientRecords()
    .then(response => {
        // was successful
    })
    .catch(error => {
        //console.log(error);
    })

[VPS Page Output] https://i.stack.imgur.com/ghoIa.png (The server is not outputting anything)

[Local Host Page output] https://i.stack.imgur.com/I6mqE.png (The server is outputting "SUCCESS!" on every refresh)

As previously mentioned, I simply copied the directory over to the remote server.

Any help to what the problem could be will be greatly appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!