Commit d1179528 authored by Yoon, Daeki's avatar Yoon, Daeki 😅
Browse files

업로드 서버쪽 주소 변경

parent fe5f5fe5
import cookieParser from "cookie-parser"; import cookieParser from "cookie-parser";
import express, { Request, Response, NextFunction } from "express"; import express, { Request, Response, NextFunction } from "express";
import path from "path";
import router from "./routes"; import router from "./routes";
const app = express(); const app = express();
...@@ -10,7 +11,7 @@ app.use(cookieParser()); ...@@ -10,7 +11,7 @@ app.use(cookieParser());
app.use("/api", router); app.use("/api", router);
app.use(express.static(__dirname + "/upload")); app.use("/images", express.static(path.join(__dirname, "..", "/uploads")));
app.use((err: any, req: Request, res: Response, next: NextFunction) => { app.use((err: any, req: Request, res: Response, next: NextFunction) => {
console.log("익스프레스 에러: ", err); console.log("익스프레스 에러: ", err);
......
...@@ -3,8 +3,9 @@ import { userCtrl, authCtrl } from "../controllers"; ...@@ -3,8 +3,9 @@ import { userCtrl, authCtrl } from "../controllers";
const router = express.Router(); const router = express.Router();
router.route("/").get(authCtrl.requireLogin, userCtrl.getProfile); router
.route("/")
router.route("/").post(authCtrl.requireLogin, userCtrl.postPicture); //중간에 req쪽에 fields와 files 넣는 미들웨어 추가 .get(authCtrl.requireLogin, userCtrl.getProfile)
.post(authCtrl.requireLogin, userCtrl.postPicture); //중간에 req쪽에 fields와 files 넣는 미들웨어 추가
export default router; export default router;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment