leebom
#6 NODEJS - MVC 본문
MVC (Model, View, Control) :일종의 패턴
M data
V data가 어떻게 생겼는지?
C (controller)data를 보여주는 함수
URL 분리
//다른 페이지에서 같은 URL를 사용해야 할수도 있기 때문에 js파일에 쪼개서 넣어주는것을 권장
//Global
const HOME = "/";
const JOIN = "/join";
const LOGIN = "/login";
const LOGOUT = "/logout";
const SEARCH = "/search";
//Users
const USER = "/users";
const USER_DETAIL = "/:id";
const EDIT_PROFILE = "/edit-profile";
const CHANGE_PASSWORD = "/change-password";
//Videos
const VIDEOS = "/videos";
const UPLOAD = "/upload";
const VIDEO_DETAIL = "/:id"; // /:id=변하는 값일 때 작성(EXPRESS가 판단할수있어짐) // /id=텍스트로 인식
const EDIT_VIDEO = "/:id/edit"; //video/1/edit
const DELETE_VIDEO = "/:id/delete";
const routers = {
home: HOME,
join: JOIN,
login: LOGIN,
logout: LOGOUT,
search: SEARCH,
users: USERS,
userDetail: USER_DETAIL,
editProfile: EDIT_PROFILE,
changePassword: CHANGE_PASSWORD,
videos: VIDEOS,
upload: UPLOAD,
videoDetail: VIDEO_DETAIL,
editVideo: EDIT_VIDEO,
deleteVideo: DELETE_VIDEO
};
export default routes;
MVC Pattern 01 · leebom21/Wetube@e359b66 · GitHub
MVC Pattern 01 · leebom21/Wetube@e359b66
Analytics cookies We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task. Learn more Accept Reject
github.com
'스터디 > 개인스터디(유투브 드림코딩 by엘리)(주5회)' 카테고리의 다른 글
#6 NODEJS - Routing (0) | 2020.11.23 |
---|---|
[유투브 클론] #6 NODEJS - middleware (0) | 2020.11.19 |
[유투브 클론] #5 NODEJS - using Babel (0) | 2020.11.12 |
[유투브 클론] #4 NODEJS - express (1) | 2020.11.11 |
[유투브 클론] #3 NODEJS 서버만들기 (0) | 2020.11.11 |
Comments