出现"Most middleware (like bodyParser) is no longer bundled with Express"错误原因新版的express中已经不包含bodyparser了,那就需要单独安装bodyparser,安装命令是npm install body-parser,然后在app.js中加载body-parser模块var bodyParser = require('body-parser'),把app.use(express.bodyParser())替换成app.use(bodyParser.urlencoded({ extended: false }))
2017-03-08
_movie.save(...)没有这个方法的解决办法是这个save其实只有一个error的参数,官网上有。还有提示_id未定义的,我发现真是坑....数据库的设计模式中字段为Number的就不能填字符串,如果填字符串就会报错。。。所以在测试数据时要小心
2017-03-05
var express = require('express')
var port = process.env.PORT || 3000
var app = express()
app.set('/','./views')
app.set('view engine','pug')
app.listen(port)
console.log('movie_website started on' + port)
app.get('/',function (req, res) {
res.render('index', {
title: 'imooc 首页'
})
})
var port = process.env.PORT || 3000
var app = express()
app.set('/','./views')
app.set('view engine','pug')
app.listen(port)
console.log('movie_website started on' + port)
app.get('/',function (req, res) {
res.render('index', {
title: 'imooc 首页'
})
})
2017-03-04