
파일과 multipart/form-data각각의 데이터 타입 그대로 전송됨 | 파일의 경우, 별도의 변환 과정을 거치지 않기에 파일 전송에 주로 사용웹 페이지에서 폼을 만들 때, multipart/form-data를 설정해 놓으면 브라우저에서 알아서 처리참고문헌: https://developer.mozilla.org/ko/docs/Web/HTTP/MIME_types#multipartform-data MIME 타입 (IANA 미디어 타입) - HTTP | MDN미디어 타입 (Multipurpose Internet Mail Extensions 또는 MIME type로도 알려져 있음)이란 문서, 파일 또는 바이트 집합의 성격과 형식을 나타냅니다. MIME 타입은 IETF의 RFC 6838에 정의 및 표준화되어..

라우트 중복 제거하기app.route() 사용// app.route('경로명')app.route('/products') .get((req, res) => { res.json({ message: 'Product 목록 보기' }); }) .post((req, res) => { res.json({ message: 'Product 추가하기' }); }); 라우터 만들기express.Router() 사용(마무리로 app.use() 사용)const productRouter = express.Router();productRouter.route('/products') .get((req, res) => { res.json({ message: 'Product 목록 보기' }); }) .post((re..

미들웨어? Express에서 리퀘스트와 리스폰스 사이에 위치하여 어떤 작업을 실행하는 함수 미들웨어 구조파라미터가 2개인 경우(가장 기본적인 구조) : req, res3개인 경우 : req, res, nextnext : 다음 미들웨어로 넘어가는 파라미터(다음 미들웨어를 가리킴)4개인 경우 : err, req, res, next참조문서: https://expressjs.com/ko/api.html#req Express 4.x - API 참조Access the API reference for Express.js detailing all modules, methods, and properties for building web applications with this version.expressjs.com// ..

Prisma 초기화npx prisma init --datasource-provider postgresql.env 파일에서windows의 경우 [postgres:password]로 변경하고, mydb를 생성할 db 이름 입력DATABASE_URL="postgresql://postgres:password@localhost:5432/comazon?schema=public"PORT=3000 User 모델 만들기// @id, @unique: 유니크한 값// @default(uuid()): uuid - 36자로 이뤄진 형식// ? : 값을 비워놔도 된다는 의미... NULL로 표시model User { id String @id email String @unique firstName Stri..