Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

leebom

#6 NODEJS - Routing 본문

스터디/개인스터디(유투브 드림코딩 by엘리)(주5회)

#6 NODEJS - Routing

d0201d 2020. 11. 23. 21:11

ES6 모듈 사용

export default app; → import app from "./app";

export const 변수명; → import { 변수명 } from "./파일명";

 

Router

express.Router();

라우트를 카테고리별로 쪼개서 묶을 수 있음.

그럼 주소가 /user/~~~ / ~~~ 이런식으로 나뉠 있음.

 

import express from "express";

export const userRouter = express.Router();

userRouter.get("/", (req, res)  =>  res.send('user index'));
userRouter.get("/edit", (req, res)  =>  res.send('user edit'));
userRouter.get("/password", (req, res)  =>  res.send('user password'));

 

 

github.com/leebom21/Wetube/commit/66971b41eeac3776c0c632dcea68018eef2e2da5

 

Routing · leebom21/Wetube@66971b4

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

 

 

 

Comments