8
E: \ wordspace \ javascript \ nodejs-demo \ node_modules \ express \ lib \ router \ index.js: 502 this.stack.push (warstwa);o ekspresie 4 routera i pchaniu
TypeError: Cannot read property 'push' of undefined
at Function.route (E:\wordspace\javascript\nodejs-demo\node_modules\express\lib\router\index.js:502:13)
at Function.proto.(anonymous function) [as get] (E:\wordspace\javascript\nodejs-demo\node_modules\express\lib\router
\index.js:509:22)
at Object.<anonymous> (E:\wordspace\javascript\nodejs-demo\routes\movie.js:6:8)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (E:\wordspace\javascript\nodejs-demo\app.js:11:13)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
To jest mój raport o błędach.
Nie mogę znieść źródła tego problemu i potrzebuję sposobu jego rozwiązania, proszę.
A to jest mój kod.
movie.js
var Movie = require('./../models/Movie.js');
var express = require('express');
var router = express.Router;
/* Get add page. */
router.get('/movie/add', function(req, res, next){
if(req.params.name){
return res.render('movie', {
title:req.params.name+'|电影|管理|movie.me',
label:'编辑电影:'+req.params.name,
movie:req.params.name
});
} else {
return res.render('movie', {
title:'新增加|电影|管理|movie.me',
label:'新增加电影',
movie:false
});
}
});
router.post('/movie/add', function(req, res, next){
res.send({'success':true});
});
app.js
var routes = require('./routes/index');
var movie = require('./routes/movie');
var users = require('./routes/users');
app.use('/', routes);
app.use('/movie', movie);
app.use('/users', users);
Proszę mi pomóc.
przepraszam, jestem learner.I 't używać stackoverflour bardzo dobrze –