04.17

조하빈 ·2023년 4월 17일
0

04월 17일 월요일


todolist 복습 중 추가내용

http://localhost:3010/user/abcd?age=18&height=176 (query String형태)
=>> const {age, height} =req.query; 이런 형태로 불러올 수 있음

  • alert에러는 catch 부분에 써줄 것!


    getTodolist로 백엔드를 불러와서 새로고침해주는 방법과
    ...todos를 이용한 스프레드 문법으로 배열 추가해주는 방법 차이 이해했음

const todos = await client.todo.findMany({
      where: {
        userId: parseInt(userId),
      },
      orderBy: {
        createdAt: "desc",
      },
    });
  • 위 코드는 투두가 생성된 순서기준으로 나열되게하는 코드 !

TODOLIST 혼자해보기 복습

  1. npm init 으로 시작
  2. npm i express, nodemon, cors 추가해주기
  3. Main express, cors 연결해주기
  4. Prisma 설치 후 시작 후 스키마 입력해주기 (npm i prisma, npx prisma init)
  5. npm i @prisma/client 설치 해준 후 router 작성한 후 app.js와 router 연결해주기
  6. frontend 제작 -> react icon, axios 설치해주기

GIT 주소 :


오늘 배운것들

각종 팁
플래닛 스케일
2422 pscale database create to-do-list --region ap-northeast
2425 npx prisma init
2426* pscale connect to-do-list
2427 npx prisma db push

profile
PPisland

0개의 댓글