강의

멘토링

커뮤니티

Inflearn Community Q&A

ljh30577130562's profile image
ljh30577130562

asked

[Revised 3rd Edition] Node.js Textbook - From Basics to Project Practice

Disconnecting the router

분리한 라우터를 한번 더 분리하고 싶으면 어떻게 해야 하나요?

Resolved

Written on

·

435

0

예를들어 api 들은

/api

로 요청을 받아서 api들만 따로 빼주었는데

여기서 한번더 /api/user

/api/board

이런식으로 분리하고싶다면 어떤 방법이 가장 좋을까요..?

node.jsexpress

Answer 1

0

hong님의 프로필 이미지
hong
Questioner

찾아보니 router에도 use를 사용할 수 있어 한번 더 분리하였습니다.

zerocho님의 프로필 이미지
zerocho
Instructor

네 맞습니다.

router.use('/', apiRouter);

apiRouter.use('/api', subApiRouter);

ljh30577130562's profile image
ljh30577130562

asked

Ask a question