Skip to content

Commit

Permalink
#203 이미지 업로드 static 폴더 경로 모듈 사용하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ho-sick99 committed Aug 10, 2023
1 parent 7741d59 commit 970fb08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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))
Expand Down

0 comments on commit 970fb08

Please sign in to comment.