리액트에서 닉네임을 post요청을 하면 서버에서 api 를 이용해서 데이터를 찾고 다시 리액트로 데이터를 줘야되는데
2일동안 해봤는데 안되서 질문드려용...
리액트에서
<form action='profile' method='POST'>
<input name='name'> //닉네임
이렇게 작성하고
서버에서
app.post('/profile',(req,res)=>{
axios.get('apiurltolong' + encodeURI(req.body.name) // api + 클라이언트에서 받아온 닉네임
.then((Response)=>{
res.sendFile('/glaemfek/build/index.html')
console.log(Response.data)}
)}
이렇게 하면 찾은 데이터들이 서버 터미널창에는 오브젝트형식으로 잘 나오는데
이걸 리액트로 보내는법을 잘 모르겠어요...