提问人:yonatan hornstein 提问时间:4/7/2023 最后编辑:yonatan hornstein 更新时间:4/7/2023 访问量:37
node.js 请求返回文档类型
node.js requests returns doctype
问:
我在 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;
提醒*** 该代码在本地主机环境中工作
提前感谢您:)
答: 暂无答案
评论