백엔드 개발

라우팅 프로세스

한고운 2023. 12. 17. 04:36

1. express 프로젝트 생성 

프로젝트명 : node02

> express node02 --view=ejs

2. 프로젝트 모듈 설치

> cd node02

> npm i

 

3. start 설정 및 실행

 "start" : "nodemon ./bin/www"  수정

> npm start

 

4. routes의 index.js 파일 체계

 

5. 라우팅 메소드 구현

6. views 파일 생성

 

7. app.js에서 라우터 파일 참조 및 호출주소 체계 정의

 

8. 웹페이지 실행 확인

http://localhost:3000/sample