Cog Factory 2020. 9. 2. 12:22

pages/search.scss

.search__header {
  margin-bottom: 30px;
  h5 {
    font-weight: 600;
    &:first-child {
      margin-bottom: 20px;
    }
  }
}

.search__videos {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  grid-gap: 30px;
  .videoBlock:first-child,
  .videoBlock:nth-child(2) {
    grid-column: span 3;
  }
  .videoBlock:nth-child(3),
  .videoBlock:nth-child(4),
  .videoBlock:nth-child(5) {
    grid-column: span 2;
  }
}

View

http://localhost:5002/search?term=운영

videoController.js - search

search

Video.find()로 video를 가져오는 부분에서 populate('creator')로 user 객체를 가져오는 코드를 추가했다.

참고 자료

소스 코드

https://github.com/zpskek/wetube-v3/commit/8c96821fd41ca241728ea10372a47184c4b4f51f