create upload dir ;)

This commit is contained in:
Artur Tamborski 2019-06-14 19:26:15 +02:00
parent 0a13b45cdd
commit 75de4b23f8

View File

@ -6,6 +6,8 @@ const app = express();
const PORT = 49376; const PORT = 49376;
const UPLOAD_DIRECTORY = './uploads'; const UPLOAD_DIRECTORY = './uploads';
!fs.existsSync(UPLOAD_DIRECTORY) && fs.mkdirSync(UPLOAD_DIRECTORY);
const upload = multer({ const upload = multer({
storage: multer.diskStorage({ storage: multer.diskStorage({
destination: (req, file, cb) => { cb(null, UPLOAD_DIRECTORY); }, destination: (req, file, cb) => { cb(null, UPLOAD_DIRECTORY); },