package.json { “name”: “blog”, “version”: “0.0.0”, “private”: true, “scripts”: { “start”: “node ./bin/www” }, “dependencies”: { “body-parser”: “~1.13.2”, “connect-flash”: “^0.1.1”, “connect-mongo”: “^1.0.1”, “cookie-parser”: “~1.3.5”, “debug”: “~2.2.0”, “ejs”: “~2.3.3”, “express”: “~4.13.1”, “express-session”: “^1.12.1”, “markdown”: “^0.5.0”, “mongodb”: “^2.0.52”, “morgan”: “~1.6.1”, “multer”: “^1.1.0”, “serve-favicon”: “~2.3.0” } }
app.js: var multer = require(‘multer’); index.js: router.get(’/upload’, checkLogin); router.get(’/upload’, function (req, res) { res.render(‘upload’, { title: ‘文件上传’, user: req.session.user, success: req.flash(‘success’).toString(), error: req.flash(‘error’).toString() }); }); router.post(’/upload’, checkLogin); router.post(’/upload’, function (req, res) { req.flash(‘success’, ‘文件上传成功!’); res.redirect(’/upload’); });
旧的问题没解决,新的问题又出现了 把multer删除后报这个错