From 970fb088430bcd2647eb06b8a1e16b2ecfd4e026 Mon Sep 17 00:00:00 2001 From: ho-sick99 <83945722+JunoJuno99@users.noreply.github.com> Date: Thu, 10 Aug 2023 09:50:32 +0900 Subject: [PATCH] =?UTF-8?q?#203=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20static=20=ED=8F=B4=EB=8D=94=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EB=AA=A8=EB=93=88=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/app.js b/server/app.js index 707af7c79..3a00f0721 100644 --- a/server/app.js +++ b/server/app.js @@ -7,6 +7,8 @@ const bodyParser = require('body-parser'); const dotenv = require("dotenv"); dotenv.config(); const { swaggerUi, specs } = require("./swagger/swagger"); // swagger +const path = require("path"); +const imgsDir = path.join(__dirname, '..', 'imgs'); // path to save uploaded files // 라우팅 const home = require("./src/routes/home"); @@ -16,6 +18,9 @@ const home = require("./src/routes/home"); app.use(express.json()) // 내장 body-parser app.use(express.urlencoded({ extended: true })) +// set static folder +app.use('/imgs', express.static(imgsDir)); // folder destination + app.use("/", home); app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(specs))