平均堆栈挂起在localhost:3000上
MEAN stack hangs on localhost:3000
我正在尝试使用BitNami版本实现MEAN堆栈。我在mean-stack-todo
演示应用程序中遇到了一些错误,所以我决定通过在终端中运行express xxx
和npm install
从头开始构建它。然后,我使用bower
(带有.bowerrc
文件)将angular
、angular-bootstrap
和jquery
安装到/public/javascripts/vendor
文件夹中。然后我开始创建所有的文件,并对代码进行必要的更改。我已经到了可以转到localhost:3000
并查看页面的地步,但控制台中出现了错误。其中一个与index.js有关(我忘了将其更改为我想要的版本——它没有找到本应在网站根目录中的.json文件,因为我的index.js文件是错误的)。在进行了必要的更改之后——我再也看不到页面了,我的浏览器挂在localhost:3000
上——它永远不会加载。这是我的index.js文件,问题必须在这里(至少部分),因为问题在我更改后就开始发生了
routes/index.js
/*
* GET home page.
*/
exports.index = function(Member) {
return function(req, res) {
Member.find({}, function(error, members) {
res.render('index', {
title: 'Express',
members : members
});
});
};
};
exports.addMember = function(Member) {
return function(req, res) {
var member = new Member(req.body);
member.save(function(error, member) {
if (error || !member) {
res.json({ error : error });
} else {
res.json({ member : member });
}
});
};
};
exports.get = function(Member) {
return function(req, res) {
Member.find({}, function(error, members) {
res.json({ members : members });
});
}
};
exports.update = function(Member) {
return function(req, res) {
Member.findOne({ _id : req.params.id }, function(error, member) {
if (error || !member) {
res.json({ error : error });
} else {
member.done = req.body.done;
member.save(function(error, member) {
if (error || !member) {
res.json({ error : error });
} else {
res.json({ member : member });
}
});
}
});
}
};
这是另一个可能相关的花絮-当我运行node app
时,我看到:
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
如果您看到任何内容,或者需要查看任何其他文件,请告诉我。我得到的最后一个错误是找不到localhost:3000/members.json
(但页面正在显示)。提前感谢!
我最终重新安装了mean stack todo应用程序并修复了错误。这与favicon.ico有关,我不得不将app.use(express.favicon());
更改为app.use(express.favicon(__dirname + '/public/favicon.ico'));
。我还必须将favicon.ico
复制到public
文件夹中。
- PHP中的setcookie仅适用于localhost
- 在localhost Dev Box上测试JSONP请求的最佳方式
- AJAX简单错误.XMLHttpRequest无法加载http://localhost/mpl/getPage.php.
- @Url.Content(“~”)不适用于localhost
- 向localhost发出带有grunt的代理CORS请求
- 岗位http://localhost:3000/api/signup400(错误请求)
- XMLHttpRequest无法加载http://localhost:3000/get.
- 为什么我的JS为我的链接添加前缀(localhost:3000 / mylink)
- 正在为ReactAsync清除localhost:3000个URL
- 错误连接拒绝http://localhost:3000/socket.io/socket.io.js.
- XMLHttpRequest无法加载“;此URL“;起源http://localhost:3000访问控制允许来源不允许
- localhost:3000 dons'切换node.js应用程序时不会更改
- 有人能解释一下为什么(http://localhost:3000/#/home) #出现在url之间吗?
- 重定向localhost而不是myserver.org:3000/login/callback
- 流星应用程序崩溃localhost:3000
- Chrome: http://localhost:3000/ - ERR_CONNECTION_REFUSED
- 热模块更换已启用但不起作用http://localhost:3000/__webpack_hmr.
- 平均堆栈挂起在localhost:3000上
- 为Heroku配置操作电缆-错误localhost:3000/Cable
- GET http://localhost:3000/projects/assets/jquery.masonry.js