node.js 请求返回文档类型

node.js requests returns doctype

提问人:yonatan hornstein 提问时间:4/7/2023 最后编辑:yonatan hornstein 更新时间:4/7/2023 访问量:37

问:

我在 namecheap 专用服务器内运行一个 node.js 应用程序并且我获得状态 200,但请求返回一个 doctype html 响应,而不是我需要的实际数据。

当我在本地主机环境中运行应用程序时,一切正常,我按预期获取数据。

当我将应用程序上传到专用的 namecheap 服务器时,我没有更改任何请求流或逻辑。

我从服务器收到每个请求的响应。!doctype html

以下是其中一个请求:

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

以下是 Tokens 模式的构建方式:

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;

提醒*** 该代码在本地主机环境中工作

提前感谢您:)

node.js 文档类型 名称便宜

评论

2赞 Geshode 4/7/2023
这可能是一个错误页面,你得到。请在您的问题中提供您的代码。或者至少是错误页面包含的错误。
1赞 Geshode 4/7/2023
所以,你看不到,错误是什么,写在文档中,你得到什么?
0赞 yonatan hornstein 4/7/2023
@Geshode 不,我只得到没有错误的html文件。
0赞 Geshode 4/7/2023
那么,HTML文件中没有写任何消息或错误吗?
0赞 yonatan hornstein 4/7/2023
@Geshode没有。只是网站描述

答: 暂无答案