小编Der*_*yer的帖子

当尝试打开我的网络应用程序时,Heroku给了我503,在本地主机上工作

我正在尝试部署到heroku,但即使它在localhost上运行,也会获得503.我很好奇我的服务器是否设置正确,因为我比编程更新.我希望任何人都可以指出我在哪里寻找或提供建议的正确方向,因为我已经在谷歌上花费了无数个小时,持续了几个星期.

我的主要问题是我是否正确设置了我的服务器?我不确定我的监听器是否适用于heroku,我的.get用于在初始设置时在localhost上进行调试.

我的完整项目也在这里:

https://github.com/dirkdir/DerekDevSite

var express = require('express');
var app = express();
var path = require('path');


app.use(express.static(path.join(__dirname, 'public')));


app.get('/json', function(req, res) {
    console.log("GET the json");
    res
        .status(200)
        .json( {"jsonData" : true} );
});

app.get('/file', function(req, res) {
    console.log("GET the file");
    res
        .status(200)
        .sendFile(path.join(__dirname, 'app.js'));
});



    var server = app.listen(process.env.PORT || 5000), function() {
        var port = server.address().port;
        console.log("Express is working on port " + port);
});
Run Code Online (Sandbox Code Playgroud)

日志:

2017-04-24T20:04:43.755866 + 00:00 app [web.1]:在Module._compile(module.js:542:28)2017-04-24T20:04:43.755867 + 00:00 app [web. 1]:在Object.Module._extensions..js(module.js:579:10)2017-04-24T20:04:43.755868 + 00:00 app …

heroku node.js express

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

express ×1

heroku ×1

node.js ×1