- 디렉토리
/
| - /node_moduels
| - /src
| --- /board
| ------- /board.route.js
| --- /user
| ------- /user.route.js
| --- index.js
| - /views
| - /public
| - package.json
| - package-lock.json
| - server.js
- 패키지 설치
npm init -y
npm install express nunjucks
- server.js 서버만들기
- express,nunjucks 설치
- src, public, views 디렉토리 생성
- src : board, user
- public : css, js, images
- view : list, write, view, modify html
- render 되는지 꼭 확인해보기
GET /
GET /boards/list
GET /boards/write
GET /boards/view
GET /boards/modify
POST /boards/write
POST /boards/modify
POST /boards/delete
GET /users/login
GET /users/join
POST /users/login
POST /users/join
총 12개의 라우터
-
src -->
index.js
- router 담고 exporst 하기
- boardRouter 가져오기
-
src --> board -->
board.router.js
- router 담고 exports 하기
- controller 가져오기
-
src --> board -->
board.controller.js
- boardService 가져오기
- 핸들러함수 exports 해서 router에 넣어주기
-
server.js
- src index.js router 가져오기
- res.send() 확인해보기
- src --> board -->
board.entity.js
- class Board 만들고 module.exports 내보내기
- src --> board -->
board.repository.js
- class Board 가져오기
- exports로 함수내보내면서 작업하기
- findAll
- create
- findOne
- src --> board -->
board.service.js
- repository 가져오기
- exports로 함수내보내면서 작업하기
- create
- getFindOne
- getFindAll
- view --> board -->
list.html
- nunjucks 반복문 사용하기
- src --> board -->
board.controller.js
- view --> board -->
write.html
- view --> board -->
view.html
- src --> board -->
board.repository.js
- incrementHit
- src --> board -->
board.repository.js
- delete
- src --> board -->
board.repository.js
- update