[TIL] module 타입으로 model 가져오기

김민재·2023년 11월 22일
0

TIL

목록 보기
57/172
import model from '../models/index.cjs';

const { Posts } = model;

// 이유는 차차 알아가자..
// 내 생각에는 index.cjs에서 데이터 모델을 받아와서 model에 담아두고 const {Posts} = model; 을 통해서 알맞는 모델을 가져오는 거 같다.

// import Posts from '../models/posts.cjs'

이게 안 되는 이유는 뭘까

profile
개발 경험치 쌓는 곳

0개의 댓글

관련 채용 정보