node.js requests returns doctype

45 Views Asked by At

Im running a node.js app inside a namecheap dedicated server and im getting status 200 but the requests return a doctype html response instead of the actual data i need.

When im running the app in a local host env everything works correctly and i get the data as intended.

I didnt change any of my requests flow or logic when i uploaded my app to the dedicated namecheap server.

I get !doctype html response for every requests from the server.

Here is one of the requests:

  await Tokens.findAll()
    .then((result) => {
        console.log("ALL tokens "+result)
      res.send(sendToClient(result, null, 1));
    })
    .catch((err) => {
      res.send(sendToClient(null, err, 0));
    });
};

here is how the Tokens modal is built:

const sequelize = require("../utils/databse");

const { DataTypes } = require("sequelize"); // Import the built-in data types

const Tokens = sequelize.define(
  "tokens",
  {
    id: {
      type: DataTypes.INTEGER(11),
      autoIncrement: true,
      allowNull: false,
      primaryKey: true,
    },
    name: {
      type: DataTypes.STRING,
      allowNull: true,
    },
    address: {
      type: DataTypes.STRING,
      allowNull: true,
    },
    symbol: {
      type: DataTypes.STRING,
      allowNull: true,
    },
    total_supply: {
      type: DataTypes.STRING,
      allowNull: true,
    },
    icon: {
      type: DataTypes.STRING,
      allowNull: true,
    },
  },
  {
    charset: "utf8",
    collate: "utf8_general_ci",
  }
);
module.exports = Tokens;

*** Reminder *** The code works in the local host env

Thank you in advance :)

0

There are 0 best solutions below