app.get('/order',function(req,res,next){ var type = 12; if (isNaN(+req.param('type'))&&req.param('type')!=undefined) next(); else { if (req.param('type')!=null) type = req.param('type'); price.getSinglePrice(type,function(err_price, result_price){ if (err_price||result_price=='none') next(); else type = result_price; }) } page.getPage(4,function(err,result){ if (err) next(new Error('problem BD')); else if (result=='none') next(); else price.getPrice(function(err_price, result_price){ if (!err_price) res.render('order',{ id : 4, title : result.title, text : result.text, meta_k : result.keywords, meta_d : result.description, price : result_price, type : type }); }) }); })
app.post('/getprice',function(req,res,next){ price.getSinglePrice(req.body.id,function(err_price, result_price){ if (err_price||result_price=='none') next(); else res.send(result_price); }) })