我在部署 Heroku 应用程序时遇到了一些问题,我只需要创建一个简单的 RESTapi 以在模拟项目中使用,我已经尝试多次部署它,但我一直收到相同的错误消息:
<块引用>2021-04-21T11:14:32.333679+00:00 heroku[路由器]:at=错误代码=H10 desc="应用程序崩溃" method=GET path="/" 主机=my-apianimal2-project.herokuapp.com request_id=f2f314b6-cace-483f-8c5f-4ef87c5199b0 fwd="213.205.240.109" dyno=连接=服务=状态=503字节=协议=https 2021-04-21T11:14:33.042735+00:00 heroku[路由器]:at=错误代码=H10 desc="应用程序崩溃" method=GET path="/favicon.ico" 主机=my-apianimal2-project.herokuapp.com request_id=6b643689-2946-451a-b62c-50f37fd13199 fwd="213.205.240.109" dyno=connect=service=status=503 bytes=protocol=https
一旦我打开应用程序的日志,就会出现错误消息,因为它无法成功打开。这是我的节点服务器代码:
const jsonServer = require('json-server');
const server = jsonServer.create();
const router = jsonServer.router('db.json');
const middlewares = jsonServer.defaults();
const port = process.env.PORT || 3000;
server.use(middlewares);
server.use(router);
server.listen(port);