프리온보딩 1월 백앤드 사전과제

ERror.ASER·2023년 1월 3일
0

프리온보딩 백앤드 과제

1. 본인이 작성했던 코드 중 공유하고 싶은 코드를 이유와 함께 마크다운 코드블락을 사용해 올려주세요


언어 상관없음
어떤 로직이든 상관없음
단, 길이가 길지 않은 함수 단위가 좋습니다

2. Layered Architecture(계층 아키텍처)에 대해서 설명해 주세요

3. Dependency Injection(의존성 주입)의 개념과 함께, 왜 필요한지 작성해 주세요


4. 본인이 사용하는 언어의 Functional Programming(함수형 프로그래밍) 스펙을 예제와 함께 소개해 주세요


5. (코드 작성) 다음 스펙을 만족하는 delay 함수를 작성해 주세요 (hint: Promise 사용)

type SomeFunctionReturnString = () => string

function delay(f: SomeFunctionReturnString, seconds: number): Promise<string> {
    // 해당 함수 내부를 구현해 주세요
};

const success = () => {
  return "successfully done";
};

const fail = () => {
  throw new Error("failed");
};

delay(success, 2)
  .then((res) => console.log(res))
  .catch((e) => console.log(e));

delay(fail, 2)
  .then((res) => console.log(res))
  .catch((e) => console.log(e));

결과값


$ ts-node delay.ts
after 2 seconds
successfully done
Error: failed

6. 강의를 통해서 기대하는 바, 또는 얻고 싶은 팁을 적어주세요

profile
지우의 블로그

0개의 댓글