app.post('/doRegister', (req, res) => {
MongoClient.connect(url, { useUnifiedTopology: true }, (err, client) => {
if (err) {
console.log("连接数据库失败");
return
}
console.log("连接数据库成功");
let db = client.db(dbName);
//req.body
let body = querystring.parse(req.body)
db.collection('order_item').insertOne(body, (err, result) => {
if (err) {
console.log("增加数据失败");
return
}
console.log("增加数据成功");
res.send(200,"增加数据成功")
})
})
})