const { Router } = require('express');
const multer = require('multer');
const uuidV1 = require('uuid/v1');

const storage = multer.diskStorage({
  destination(req, file, cb) {
    cb(null, 'upload/jkef');
  },
  filename(req, file, cb) {
    const extName = file.originalname.split('.').reverse()[0];
    cb(null, `${uuidV1()}.${extName}`);
  },
});


const upload = multer({ storage });


const router = new Router();


router.post('/upload',
  upload.single('file'),
  (req, res) => {
    res.json(req.file);
  }
);

export default router;

@@ -100,16 +100,142 @@
 id/v1');
+%0Aconst expressJwt = require('express-jwt');%0Aconst %7B secret %7D = require('../config');%0Aconst %7B getToken %7D = require('../utils');
 %0A%0Aconst 
@@ -564,16 +564,107 @@
 pload',%0A
+  // %E7%A1%AE%E4%BF%9D%E7%94%A8%E6%88%B7%E5%B7%B2%E7%99%BB%E5%BD%95%0A  expressJwt(%7B%0A    secret,%0A    credentialsRequired: true,%0A    getToken,%0A  %7D),%0A
   upload

add expressJwt