Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

199
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda