javascript - 由信号 SIGSEGV 终止的命令行“deno run server.ts”中的错误(地址边界错误)
问题描述
控制器/products.ts
import { Product } from "../types.ts";
let products: Product[] = [
{
id: "1",
name: "Product One",
description: "This is product one",
price: 29.99,
},
{
id: "2",
name: "Product Two",
description: "This is product two",
price: 39.99,
},
{
id: "3",
name: "Product Three",
description: "This is product three",
price: 59.99,
},
];
export const getProducts = ({ response }: { response: any }) => {
response.body = {
success: true,
data: products
}
}
路线.ts
import { Router } from "https://deno.land/x/oak/mod.ts";
import { getProducts } from "./controllers/products.ts";
const router = new Router()
router.get('/api/v1/products', getProducts)
export default router;
服务器.ts
import { Application } from "https://deno.land/x/oak/mod.ts";
import router from './routes.ts';
const app = new Application()
console.log(`Server running on http://localhost:5000`);
app.use(router.routes())
app.use(router.allowedMethods())
await app.listen({ port: 5000 })
我一直在尝试使用命令行中的命令运行文件server.ts
deno run --allow-net server.ts
我得到的只是命令行错误
fish: “deno run server.ts” terminated by signal SIGSEGV (Address boundary error)
Everyting 工作正常。突然开始不行了
解决方案
推荐阅读
- javascript - VueJS - 使用 vue 提供创建全局服务功能,在 vue 组件中调用服务时未定义
- vue.js - 如何在Vue中进行求和
- javascript - 无法将时间戳转换为格式化日期
- react-native - 编辑时如何在文件上传中获取文档
- reactjs - 如何修复“Array.prototype.filter() 期望在箭头函数结束时返回一个值”
- excel - 基于列值复制行的循环
- postgresql - 如何将 Find 的输出排序到 psql 复制命令以按顺序加载数据?
- python - Scipy或贝叶斯优化函数在python中具有约束、边界和数据框
- c++ - 带有无效错误和循环问题的 for 循环
- firebase - 如何在颤动中向 2 个用户提供 1 个 firebase id?