[Node.js] 페이징 처리


[Node.js] 페이징 처리

선수 지식 : 페이징 처리 개념 1. 페이징 처리 방법 서울특별시 게시판 1) 주어지는 값 rows 데이터베이스에서 받은 전체 게시물 currPage 클라이언트에게 받은 현재 페이지 displayRowCnt 화면에 보여지는 게시물 개수 displayPageCnt 화면에 보여지는 페이지 개수 2) 계산해야 하는 값 totalPage 전체 페이지 개수 Math.ceil(rows.length / displayRowCnt) startPage 화면에 보여지는 시작 페이지 Math.floor((currPage - 1) / displayPageCnt) * displayPageCnt + 1 endPage 화면에 보여지는 마지막 페이지 startPage + (displayPageCnt - 1) no 화면에 보여지는 첫번째 게시물 인덱스 displayRowCnt * (currPage - 1) result 화면에 보여지는 게시물 rows.splice(no, displayRowCnt) 2. 페이징 처리 ...


#nodejs #백엔드 #페이징처리

원문링크 : [Node.js] 페이징 처리