`UPDATE CARDINFO SET title="${data.title}",todo="${data.todo}",ck="${data.ck}" WHERE name="${data.name}" AND date="${data.date}" AND time="${data.time}";`;
console.log(sql);
// const params = [
// data.isPublic,
// data.name,
// data.date,
// data.time,
// data.title,
// data.todo,
// data.ck,
// ];
connection.query(sql,(err,rows,fields)=>{
if(err){
res.send({
code:400,
message:"error",
});
}else{
res.send({
code:200,
message:"success",
});
}
});
});
app.delete("/api/deletecard",(req,res)=>{
constdata=req.body;
constsql=
"INSERT INTO CARDINFO(isPublic,name,date,time,title,todo,ck) VALUES(?,?,?,?,?,?,?);";
constparams=[
data.isPublic,
data.name,
data.date,
data.time,
data.title,
data.todo,
data.ck,
];
connection.query(sql,params,(err,rows,fields)=>{
if(err){
res.send({
code:400,
message:"error",
});
}else{
res.send({
code:200,
message:"success",
});
}
});
});
app.post("/api/signup",async(req,res)=>{
constdata=req.body;
constsql="INSERT INTO USERINFO(userID,userPW,userName) VALUES(?,?,?);";