javascript - Nodejs fastify 崩溃 heruku api
问题描述
我正在尝试加载一个用nodejs
and编写的简单 api fastify
,如下面的代码所示。
当我尝试打开页面时,我在 中收到这样的错误logs
,并且页面给了我Application
错误。
你能帮我个忙吗?
at=error code=H10 desc="App crashed" method=GET path="/" ... dyno= connect= service= status=503 bytes= protocol=https
包.json
{
"name": "fastPro",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"fastify": "^3.11.0",
"nodemon": "^2.0.7"
}
}
index.js
const fastify = require('fastify')()
// Declare a route
fastify.get('/', (request, reply) => {
reply.send({ hello: 'world!' })
})
// Run the server!
fastify.listen(process.env.PORT, (err, address) => {
if (err) throw err
fastify.log.info(`server listening on ${address}`)
})
档案
web: node src/index.js
worker: node src/index.js
解决方案
推荐阅读
- git - git new 合并请求是否会包含用于重新部署分支更改的还原主提交?
- java - 为什么Android应用程序崩溃?
- php - Prestashop 1.6 / Thirtybees:如何调用 Product.tpl 的功能?
- pyspark - 在 PySpark 数据框中 - 连接多行的字符串值并按项目 ID 分组
- java - 从鼠标处理程序中调用非静态方法会导致错误:“无法从静态上下文引用非静态方法
- powershell - 找不到请求的 .Net Framework 数据提供程序。它可能没有安装。在 Powershell 中运行时
- groovy - 从另一个 .groovy 文件中的 .groovy 文件调用方法
- batch-file - 批处理脚本总是要求在早上覆盖文件
- python - docker 不安装包 enviirons
- swift - Swift:cUrl 等效 Alamofire 请求