js base64解码 并且将解码后的图片储存
server.js
app.get('/getpicture',(req,res)=>{
console.log(req.query) // 客户端请求的传参data数据
const openid=req.query.openid
var connection=mysql.createConnection({
host:'',
port: 3306, //端口号
user:'w',
password:'123456',
database:'w'
})
connection.connect();
connection.query("SELECT pic FROM picture WHERE num=1",function(error,results,fields){
if(error) console.log(error);
res.json(results)
console.log(results)
})
connection.end();
})