[React] mysql React , select, insert, update, delete문 사용
2022. 7. 11.
사용할 테이블 Select문 1. react에서 경로/요청구문을 작성해 서버에 자료를 요청한다. async function getCustomer(){ const customers = await axios.get(`http://localhost:3001/customers`) return customers.data; } /customers로 요청하였다. 2. 서버에서 요청구문으로 값을 받은 후 돌려보낼 자료를 리턴해준다. app.get('/customers', async (req,res) => { connection.query( "select * from customers_table", (err,rows,fields)=>{ res.send(rows); } ) }) rows전체를 보내주도록 한다. 테이블의 모..