diff --git a/app.js b/app.js index f2203f9..14cc610 100644 --- a/app.js +++ b/app.js @@ -19,6 +19,8 @@ app.use(cors({ origin: process.env.CORS_ORIGIN, credentials: true // 允许携带Cookie,后续若需记住登录状态可用 })); +// 配置静态资源服务 +app.use('/uploads', express.static('uploads')); // 2. 测试数据库连接(启动时自动验证) testDbConnection(); diff --git a/image.png b/image.png deleted file mode 100644 index 8481d4d..0000000 Binary files a/image.png and /dev/null differ diff --git a/models/Product.js b/models/Product.js index e7a952a..7f5f49a 100644 --- a/models/Product.js +++ b/models/Product.js @@ -33,7 +33,7 @@ const Product = sequelize.define('Product', { allowNull: true, comment: '商品分类' }, - image_url: { + imageUrl: { type: DataTypes.STRING(255), allowNull: true, comment: '商品图片URL' @@ -61,7 +61,7 @@ const Product = sequelize.define('Product', { charset: 'utf8mb4', collate: 'utf8mb4_unicode_ci', freezeTableName: true, - syncOnAssociation: false + syncOnAssociation: false, }); module.exports = Product; \ No newline at end of file diff --git a/uploads/images/.gitkeep b/uploads/images/.gitkeep new file mode 100644 index 0000000..16cd381 --- /dev/null +++ b/uploads/images/.gitkeep @@ -0,0 +1 @@ +# This file keeps the images folder in git \ No newline at end of file diff --git a/uploads/images/iPhone17promax.png b/uploads/images/iPhone17promax.png new file mode 100644 index 0000000..e50bb40 Binary files /dev/null and b/uploads/images/iPhone17promax.png differ