From 8dd3d8cd3840fbde1c04d11e037b759e292a70f4 Mon Sep 17 00:00:00 2001 From: Hongmin Lee Date: Tue, 7 Jan 2025 13:04:10 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - init.js | 15 +++++++++++++ package.json | 61 ++++++++++++++++++++++++++-------------------------- 3 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 init.js diff --git a/.gitignore b/.gitignore index 7252066..e00e7a4 100644 --- a/.gitignore +++ b/.gitignore @@ -35,7 +35,6 @@ build/ # Environment variables .env -constants.js # Temporal data data/ diff --git a/init.js b/init.js new file mode 100644 index 0000000..ad11984 --- /dev/null +++ b/init.js @@ -0,0 +1,15 @@ +const fs = require('fs'); +const path = require('path'); + +// 생성할 폴더 목록 +const folders = [path.join(__dirname, 'uploads')]; + +// 폴더 생성 함수 +folders.forEach((folder) => { + if (!fs.existsSync(folder)) { + fs.mkdirSync(folder, { recursive: true }); + console.log(`폴더 생성 완료: ${folder}`); + } else { + console.log(`폴더가 이미 존재합니다: ${folder}`); + } +}); diff --git a/package.json b/package.json index 2663a04..3660330 100644 --- a/package.json +++ b/package.json @@ -1,32 +1,33 @@ { - "name": "backend", - "version": "1.0.0", - "description": "커뮤니티의 백엔드 서버입니다.", - "main": "server.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "node server.js" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "eslint": "^8.57.1", - "eslint-config-airbnb": "^19.0.4", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.31.0", - "eslint-plugin-prettier": "^5.2.1", - "prettier": "^3.3.3" - }, - "dependencies": { - "bcrypt": "^5.1.1", - "cookie-parser": "^1.4.7", - "cors": "^2.8.5", - "dotenv": "^16.4.5", - "express": "^4.21.1", - "express-session": "^1.18.1", - "multer": "^1.4.5-lts.1", - "mysql2": "^3.11.3", - "uuid": "^11.0.3" - } + "name": "backend", + "version": "1.0.0", + "description": "커뮤니티의 백엔드 서버입니다.", + "main": "server.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js", + "init": "node init.js" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "eslint": "^8.57.1", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-prettier": "^5.2.1", + "prettier": "^3.3.3" + }, + "dependencies": { + "bcrypt": "^5.1.1", + "cookie-parser": "^1.4.7", + "cors": "^2.8.5", + "dotenv": "^16.4.5", + "express": "^4.21.1", + "express-session": "^1.18.1", + "multer": "^1.4.5-lts.1", + "mysql2": "^3.11.3", + "uuid": "^11.0.3" + } }