Restful implementation of express routes do not work on the server

0

I have a Restful API implemented in NodeJS running normally locally, with all the routes responding, all right. However, when putting into production on the KingHost server only the root route works.

I made a basic application for testing alternative routes and it also did not work.

Follow the code below:

var express = require('express');
var app = express();

app.all("*", (req, res, next) => {
    console.log('Time:', Date.now());
    next();
});

app.get("/", (req, res) => res.send("ROOT"));
app.get("/novo", (req, res) => res.send("NOVO"));

app.listen(process.env.PORT || 21265, () => console.log("Server is running!"));

Has anyone ever had a similar problem or am I forgetting something?

EDIT: I got in touch through a call with the KingHost team and they replied that this type of service only works when adding the port in the URL. Unfortunately there is no other alternative ¬¬

    
asked by anonymous 10.05.2018 / 19:28

0 answers