我很确定我的代码正确
index.js
//...
const winston = require('winston');
const express = require('express');
const app = express();
require('./startup/logging');
require('express-async-errors');
require('./startup/routes')(app);
require('./startup/db').connect();
require('./startup/config')();
require('./startup/validation')();
require('./startup/prod')(app);
app.get('/', function(req, res, next){
res.status(200).send('Welcome!');
});
//error handler
app.use(errorHandler);
const port = process.env.PORT || 3000
const server = app.listen(port, () => winston.info(`listening on port ${port}`))
module.exports = server
和parkage.json
{
//...
"main": "index.js",
"scripts": {
//...
"start": "node index.js"
},
"engines": {
"node": "10.x",
"npm": "6.x"
},
//....
}
我部署到Heroku并收到此错误...heroku[web.1]: Process exited with status 0 ...heroku[web.1]: State changed from starting to crashed
最初它在工作,但是突然停了下来,我遵循了我在网上找到的所有说明,但是没有任何工作可以有人帮助吗?