最新回答 / qq_天天天晴_4
routes.js Userlist路由寫錯(cuò)了
可向數(shù)組插入數(shù)據(jù)
var reply = {
from: _comment.from,
to: _comment.tid,
content: _comment.content
}
Comment.update({_id:_comment.cid}, {'$push':{reply:reply} } ,function(err,news) {
if(err)console.log(err);
console.log(news);
} );
var reply = {
from: _comment.from,
to: _comment.tid,
content: _comment.content
}
Comment.update({_id:_comment.cid}, {'$push':{reply:reply} } ,function(err,news) {
if(err)console.log(err);
console.log(news);
} );
2018-05-25
現(xiàn)在可以用中間件解決
router.use(function(req,res,next) {
let user = req.session.user
if(!user) {
return res.redirect('/user/signin')
}
next()
})
router.use(function(req,res,next) {
let user = req.session.user
if(!user) {
return res.redirect('/user/signin')
}
next()
})
2018-05-24
grunt mochaTest --timeout=5000
mocha默認(rèn)每個(gè)測試用例最多執(zhí)行2000毫秒,如果超過這個(gè)時(shí)間沒有返回結(jié)果,就會(huì)報(bào)錯(cuò)
mocha默認(rèn)每個(gè)測試用例最多執(zhí)行2000毫秒,如果超過這個(gè)時(shí)間沒有返回結(jié)果,就會(huì)報(bào)錯(cuò)
2018-05-24
https://github.com/xupeiMax/movie-by-node
還是貼一下,上個(gè)月19號(hào)花一天跟完一期,之后因?yàn)楣緲I(yè)務(wù)遲遲沒有時(shí)間學(xué)習(xí)第二期,主要就是學(xué)習(xí)思路,很感謝慕課網(wǎng)這個(gè)平臺(tái)!
還是貼一下,上個(gè)月19號(hào)花一天跟完一期,之后因?yàn)楣緲I(yè)務(wù)遲遲沒有時(shí)間學(xué)習(xí)第二期,主要就是學(xué)習(xí)思路,很感謝慕課網(wǎng)這個(gè)平臺(tái)!
2018-05-13