๐ฉ๐ป ๋ฐฑ์๋(Back-End)/Nest js
[Nest JS ๋ก CRUD ๊ฒ์ํ ๋ง๋ค๊ธฐ] (20) ๋ชจ๋ ๊ฒ์๋ฌผ ๊ฐ์ ธ์ค๊ธฐ
์ง์ง์ํ์นด
2023. 6. 6. 00:09
728x90
๋ฐ์ํ
<๋ณธ ๋ธ๋ก๊ทธ๋ John Ahn ์ ์ ํ๋ธ๋ฅผ ์ฐธ๊ณ ํด์ ๊ณต๋ถํ๋ฉฐ ์์ฑํ์์ต๋๋ค :-)>
=> ๋ฐ๋ผํ๋ฉด์ ๋ฐฐ์ฐ๋ NestJS
๐งธ ๋ชจ๋ ๊ฒ์๋ฌผ ๊ฐ์ ธ์ค๊ธฐ
๐ board.service.ts
// ๋ชจ๋ ๊ฒ์๋ฌผ ์กฐํํ๊ธฐ
async getAllBoards(): Promise <Board[]> {
return this.boardRepository.find();
}
๐ board.controller.ts
// ๋ชจ๋ ๊ฒ์๋ฌผ ์กฐํํ๊ธฐ
@Get("/")
getAllBoard(): Promise<Board[]> {
return this.boardsService.getAllBoards();
}
728x90
๋ฐ์ํ