bu hatayı alıyorum değil Fonksiyon paramlarında tanımladı.düğüm js bir fonksiyon/ekspres js
Yönlendirici Js:
router.post('/era',controlleri.book,booking_controller.book,function(req,res){
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
console.log("done in server.js");
});
Bu benim next();
kullanıyorum neden öylesine thats eşzamanlı fonksiyonunu gerçekleştirmek istediğiniz benim yönlendirici dosyasıdır. sonraki fonksiyon yani booking_controller.book
yürütüldüğünde ancak program hatası vererek dursa da
module.exports.book=function(req,res,next){
var dates=req.body.dates;
var times=req.body.times;
var result="yes";
var query=`dates.${dates}.${times}.ava`;
db.mohd.find({[query]:result},{userid:1,_id:0},function (err, docs) {
if(err){
res.send(404);
}else if(docs==null){
res.send(404);
}else{
if(req.body){
var thid=req.body.therapist_id;
var dates=req.body.dates;
var times=req.body.times;
var query=`dates.${dates}.${times}.ava`;
db.mohd.update({ userid: thid },
{ $set: { [query]: "no" } }, function() {
console.log("updated");
});
**next();** //Here the error occurs
}else{
res.send("Get the F out of here");
}
}
});}
:
Controller.Book fonksiyon kodu
next is not a function
Lütfen kodunuzu düzgün bir şekilde girintili olarak girin. Bu sadece bir kaos. – str
İşlev parametrelerinizde "next" öğesini göremiyorum. Bize biraz daha kod yazabilir misiniz lütfen? – Pedro
Üzgünüz eklendi Tam düzgün kod @Pedro –