전반적인 Router 구성하기
개발/Node.js2024. 10. 25. 15:40전반적인 Router 구성하기

1. Route Tree - 사용자의 마인드가 되어 웹사이트이 구조를 어떻게 만들지를 구상해야 함 - globalRouter에 login search Router 만들기# Global/ -> Home/join - Join/login -> Login/search -> Search# User/user/:id -> See profile/user/logout -> Log out/user/edit -> Edit my profile/user/delete -> Delete my profile# Videos/videos/:id - > See watch video in my channel/videos/:id/edit -> Edit video/videos/:id/delete -> Delete video/videos/up..

개발/Node.js2024. 10. 24. 16:20Router(2)

1. Router 추가 생성// globalRouter.jsimport express from "express";const globalRouter = express.Router();const handleHome = (req, res) => res.send("Home");const handleJoin = (req, res) => res.send("Join");globalRouter.get("/", handleHome);globalRouter.get("/join", handleJoin);export default globalRouter;// userRouter.jsimport express from "express";const userRouter = express.Router();const handleEdi..

Router(1)
개발/Node.js2024. 10. 24. 10:15Router(1)

1. Routerhttps://expressjs.com/en/api.html#router Express - Node.js web application framework expressjs.com - Router는 Controller와 URL을 관리 - You can think of it as a “mini-application”  - 작업중인 주제를 기반으로 URL을 그룹화# URL# Global/ -> Home/join - Join/login -> Login/search -> Search# User/user/edit -> Edit User/user/delete -> Delete User# Videos/videos/watch - > Watch vidoo/videos/edit -> Edit video/vid..

image