Commit 6549ba7e authored by kusang96's avatar kusang96
Browse files

dd

parent 7cb7c566
import express from "express";
import path from 'path';
import multer from 'multer';
import productCtrl from '../controllers/product.controller.js';
// process.cwd() + '/client/public/image'
const router = express.Router()
const upload = multer({
storage: multer.diskStorage({
destination(req, file, cb) {
cb(null, 'uploads/');
}, // 저장 경로 변경
filename(req, file, cb) {
cb(null, new Date().valueOf() + path.extname(file.originalname));
}, // 파일명 변경
}),
});
router.route('/regist')
.post(productCtrl.regist)
// upload.array('main_image'),
.post(productCtrl.imageUpload, productCtrl.regist)
export default router
\ No newline at end of file
import mongoose from 'mongoose'
import mongoose, { mongo } from 'mongoose'
const { String, Number, Array } = mongoose.Schema.Types
const { String, Number } = mongoose.Schema.Types
const productschema = new mongoose.Schema ({
pro_name: {
type: String,
required: true
}
})
const ProductSchema = new mongoose.Schema({
pro_name: {
......@@ -25,20 +32,19 @@ const ProductSchema = new mongoose.Schema({
required: true,
},
sub_category: {
type: Array,
type: [String],
required: true,
},
description: {
type: String,
required: true,
},
main_image: {
main_imgUrl: {
type: String,
required: true,
required: true
},
detail_image: {
type: String,
required: true,
detail_imgUrls: {
type: [String]
}
}, {
timestamps: true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment