Find(2)
-
TypeORM 함수 with NestJS
@Injectable() export class PostsService { constructor( @InjectRepository(PostsModel) private readonly postsRepository: Repository, ) {} //... } find 다수의 데이터 가져오기 async getAllPosts() { return this.postsRepository.find(); } findOne 하나의 데이터 찾기 async getPostById(id: number) { const post = await this.postsRepository.findOne({ where: { id, }, }); if (!post) { throw new NotFoundException(); } return po..
2023.12.14 -
배열 [ Javascript ] [ JavaScript 문법 종합반 1주차 ]
// 배열 // 1 생성 // 1-1 기본 생성 let fruits = ["사과", "바나나", "오렌지"]; console.log(fruits); // [ '사과', '바나나', '오렌지' ] // 1-2 크기 지정 let number = new Array(5); console.log(number); // [ ] console.log(number.length); // 5 // 2 요소 접근 console.log(fruits[0]); // 사과 console.log(fruits[1]); // 바나나 console.log(fruits[2]); // 오렌지 // 3 배열 메소드 // 3-1 push let frts = ["사과", "바나나"]; console.log(frts); // [ '사과', '바나나'..
2023.06.12