Develop/곤부📙

스터디 / 0819

밀김 2023. 8. 19. 15:04
728x90

 

 

 

 

 

 

 

 

 

- 요청헤더에는 url 정보가 들어간다

 

- api는 데이터 매핑용이다(url이아님)

 

 

ResponseEntity<Object>

이거는 상태코드를 우리가 클라이언트에게 반환할수 있다. 이걸 갖고 프론트단에서 조건처리를 할수있음

 

 

 

- A페이지에서 B페이지로 넘어가게 하는게 라우팅

 

 

 

- 프론트의 예외처리

onMounted(()=>{
    fetch(`http://localhost:8080/restaurant/160/menu`)
    .then(response=>{
        if(!response.ok)
            throw new Error("오류인거셈!!")
        return response.json()
    })
    .then(list=>{
        console.log(list);
    })
    .catch(error=>{
        console.log(error);
    })
})

 

 

 

- 타임리프의 dataset과 비슷한거임 useRoute().params는 약속된 구문

let restaurantId = useRoute().params.id

 

 

 

https://velog.io/@skyepodium/vue-ref-%EC%86%8D%EC%84%B1-feat.-%EC%A3%BC%EC%9D%98%ED%95%A0-%EC%A0%90

 

[vue] ref 속성 (feat. 주의할 점)

[vue] ref 속성

velog.io

 

 

 

 

- url이 중복된다면? api 컨트롤러로 빼서 url을 간단히 만들자(?) 어디서 시작하는지 봐야함 레스토랑의 메뉴인지, 그냥 메뉴만 가져와도 되는지. DB위주로 생각하면 된다

 

 

- 리퀘스트 바디는 제이슨 객체를 받을때 사용됨

 

- 리퀘스트 바디는 무조건 json.stringfy로 받아줘야함

 

- get요청이 아니면 무조건 method 명시 해줘야함

 

 

 

 

 

 

 

 

 

 

 

 

 

728x90