안내사항
프로젝트 관련
- project 5는 추후에 공개 예정입니다.
- 다음 주는 project 4를 이어서 진행해주세요!
이력서 특강
- 다음주 수요일 (11월 2일) - 토스 진유림님
NestJS
- 구글에서 만들었음
- AngularJS의 모듈 활용
- Dependency Injection
- Module 방식
Singleton
- 싱글톤 컨테이너가 있음
- 싱글톤 객체를 주입하는 방식
Standard App
- 꼭 서버로 사용되어야 하는 것은 아님
- Batch 작업이나
- Schedule 작업에도 사용될 수 있음
Layered Architecture
- 환경에 따라 격리하기가 좋음
- 로컬/개발/QA/Real
설계를 어떻게 해야 좋을지 모를 때 → 프레임워크를 한 번 써보자 ( 기본적으로 설계를 강제하는 구조 )
Singleton Container를 직접 만들어보자
- 실습
Decorator
요구사항
function Injectable(){} function Inject(){} function getInstance(){} @Injectable() class Foo { hello() { console.log('hello world') } } @Injectable() class Bar { constructor( @Inject(Foo) public foo: Foo ) {} } class Parent {} @Injectable(Parent) class Child extends Parent { constructor() {} } // Repository // Local에서는 메모리 DB를 쓰고 싶고 // Dev에서는 A라는 DB를 쓰고 싶고 // QA에서는 B라는 DB를 쓰고 싶고 getInstance(Foo) === getInstance(Foo); // true getInstance(Bar) === getInstance(Bar); // true Object.getPrototypeOf(getInstance(Parent).constructor) === Parent; // true