8월6일(금)

손승우·2021년 8월 6일
0

오늘한 것

  • 서버 미들웨어, 익스프레스등 실제로 구현해봤다.

느낀점

  • 죽을맛. 코드를 짜면서 코드는 같은 기능을하는데 하나는 구현이 가능하고 다른표현으로는 구현이 불가능했다 뭐지

이후할 것

    if (req.query.departure_times !== undefined && req.query.arrival_times !== undefined) {
      
      const list = flights.filter((item) => {
        return item.departure_times.includes(req.query.departure_times.toUpperCase());
      });
      const list2 = list.filter((el) => {
        return el.arrival_times.includes(req.query.arrival_times.toUpperCase());
      })
      return res.status(200).json(list2);
    }
    if(req.query.departure !== undefined && req.query.destination !== undefined){
      const list = flights.filter((el) => {
        return el.departure.includes(req.query.departure.toUpperCase());
      })

      const list2 = list.filter((el) => {
        return el.destination.includes(req.query.destination.toUpperCase())
      })

      return res.status(200).json(list2)
    }

    //TODO: 
    return res.json(flights);
  },

코드를 구현하면 서 필터를 썻는데 따로 필터를 쓰는 함수를 만들어서 깔끔하게 만들어주기.

현재 문제중에서 반타작..을 못풀었는데 디버깅하면서 풀기

profile
개구리

0개의 댓글