product.routes.js 654 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
import express from "express";
kusang96's avatar
kusang96 committed
2
3
import path from 'path';
import multer from 'multer';
Jiwon Yoon's avatar
Jiwon Yoon committed
4
5
import productCtrl from '../controllers/product.controller.js';

kusang96's avatar
kusang96 committed
6
7
// process.cwd() + '/client/public/image'

Jiwon Yoon's avatar
Jiwon Yoon committed
8
9
const router = express.Router()

kusang96's avatar
kusang96 committed
10
11
12
13
14
15
16
17
18
19
20
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));
        }, // 파일명 변경
     }),
});

Jiwon Yoon's avatar
Jiwon Yoon committed
21
22
router.route('/regist')
    .post(productCtrl.regist)
kusang96's avatar
kusang96 committed
23
// upload.array('main_image'), 
Jiwon Yoon's avatar
Jiwon Yoon committed
24
export default router