var cool = require('cool-ascii-faces');
var express = require('express');
var bodyParser = require('body-parser');
var bytes = require('bytes');
var app = express();
app.set('port', (process.env.PORT || 5000));
app.use(express.static(__dirname + '/public'));
// views is directory for all template files
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.get('/', function(request, response) {
response.render('pages/index');
});
app.get('/cool', function(request, response) {
response.send(cool());
});
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});
Добрый день, когда делаю запрос на "body - parser
", потом заливаю на хероку он зависает, в чем может быть причина?
Обновление
Когда я удалю строчку
var bodyParser = require (' body - parser ');
то сайт загружается, а когда строчка присутствует, то хероку выдает
" An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner , check your logs for details . "
То есть при запросе 'body - parser', сайт зависает
Ошибка, которую пишет Firefox
GET https://blooming-forest-9227.herokuapp.com/index.html [HTTP/1.1 503 Service Unavailable 4805мс]
Обновление 2
Из Application Log.
2015-12-18T10:52:22.221940+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:2:18)
2015-12-18T10:52:22.221941+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-12-18T10:52:22.221942+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-12-18T10:52:22.922664+00:00 heroku[web.1]: Process exited with status 1
2015-12-18T10:52:25.536880+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=de7ab448-2911-4bc5-b0d7-87e182960268 fwd="194.44.185.28" dyno= connect= service= status=503 bytes=
2015-12-18T10:52:22.221940+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:2:18)
2015-12-18T10:59:37.726517+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=73ede656-79dd-4ca7-9113-c470c1a2ff0c fwd="194.44.185.28" dyno= connect= service= status=503 bytes=
2015-12-18T10:59:52.731762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=d92530f9-5776-429f-925e-e060b3af644a fwd="194.44.185.28" dyno= connect= service= status=503 bytes=
2015-12-18T10:59:55.274179+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=62086d88-1260-472e-9a6c-817374a7e2f1 fwd="194.44.185.28" dyno= connect= service= status=503 bytes=
2015-12-18T10:52:22.221941+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-12-18T10:59:52.731762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=d92530f9-5776-429f-925e-e060b3af644a fwd="194.44.185.28" dyno= connect= service= status=503 bytes=
2015-12-18T11:01:54.274069+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:336:15)
2015-12-18T11:01:54.274069+00:00 app[web.1]: at Function.Module._load (module.js:278:25)
2015-12-18T11:01:54.274071+00:00 app[web.1]: at require (module.js:384:17)
2015-12-18T11:01:54.274074+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-12-18T11:01:54.274074+00:00 app[web.1]: at Function.Module.runMain (module.js:501:10)
2015-12-18T11:01:51.773298+00:00 heroku[web.1]: State changed from crashed to starting
bodyParser
? Вы же его не используете! – Dmitriy Simushev 17 дек '15 в 16:27body-parser
точно установлен? – Dmitriy Simushev 17 дек '15 в 17:58