我在 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;
*** 提醒 *** 该代码在本地主机环境中工作
提前谢谢你:)