ORM이란? 데이터베이스를 조작하기 위해 SQL 문을 작성해야 합니다. 하지만 SQL 문법을 코드와 함께 작성하면 가독성이 떨어집니다. 이런 문제를 해결하기 위해 ORM을 사용합니다. Object Relational Mapping은 객체(Object)와 관계(Relation)를 맵핑(Mapping)하여 비즈니스 로직에 집중할 수 있도록 데이터 처리를 도와줍니다. ORM을 사용하면 DBMS에 종속되지 않으며 생산성, 독립성, 가독성 및 유지보수 측면에서 장점이 있습니다. 하지만 Query가 복잡해질수록 오히려 생산성이 떨어지는 단점도 존재합니다. Sequelize란? Node에서 가장 많이 사용되는 ORM입니다. Promise를 기본으로 동작하기 때문에 비동기 코드를 보기 좋게 작성할 수 있습니다. Sequelize 설치하기 Sequelize cli를 통해서 migration, seeder, model의 초기 설정을 할 수 있습니다. (migrat
What is MVC? Model - View - Controller architectural pattern that separates an application into three main logical components. Each of these components are built to handle specific development aspects of an application. Model Model component corresponds to all the data-related logic that the user work with. This can represent either the data that is being transferred between view and controller components. Model is connected to the database and can bring data. Model requested by t
ORM Object Relational Mapping ORM이 통역, 중개 역할을 한다. 객체(Object)에서의 속성은 데이터베이스에서는 각 필드라고 볼 수 있다. Sequelize promise-based Node.js ORM Postgres MySQL MariaDB SQLite ex) 예시 코드 Association (== join) HasOne BelongsTo HasMany BelongsToMany Transaction Sequelize 및 CLI 도구 이용 SQL문법을 이용해 만들 필요 없이, ORM을 통해 쉽게 테이블을 만들 수 있습니다. Sequelize 사용을 위해 n