스크린샷 2023-11-30 오후 12.53.09.png

Routing

@Controller('hello')
export class HelloController {
	@Get()
	get(): string {
		return 'get';
	}

	@Post()
	create(): string {
		return 'create';
	}

	@Put()
	update(): string {
		return 'update';
	}

	@Delete()
	remove(): string {
		return 'remove';
	}
}

@Controller 데코레이터 사용

모든 표준 HTTP 메서드를 데코레이터 제공

매개변수 와 쿼리스트링

// 예시 /hello/coolmarvel?country=korea

@Get(':name')
get(@Param('name') name: string, @Query('country') country: string) {
	return `my name is ${name} from ${country};
}

@Param: 매개변수

@Query: 쿼리스트링