GET 请求股票价格检查器项目 - TypeError

问题描述

我正在开发一个股票价格检查器项目。

完整的项目:https://boilerplate-project-stockchecker-5.fcc5743df.repl.co/

我的代码https://replit.com/@fcc5743df/boilerplate-project-stockchecker-5#tests/2_functional-tests.js

这些是需要在我的代码上传递的测试:

  • 查看一只股票:向 /api/stock-prices/ 发送 GET 请求
  • 查看一只股票并喜欢它:向 /api/stock-prices/ 发送 GET 请求
  • 查看同一只股票并再次点赞:向 /api/stock-prices/ 发送 GET 请求
  • 查看两只股票:向 /api/stock-prices/ 发送 GET 请求
  • 查看两只股票并喜欢它们:向 /api/stock-prices/ 发送 GET 请求

这是 https://boilerplate-project-stockchecker-5.fcc5743df.repl.co/api/stock-prices/ 上的错误

TypeError: Cannot read property 'length' of undefined
at /home/runner/boilerplate-project-stockchecker-5/routes/api.js:23:33
at Layer.handle [as handle_request] (/home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/layer.js:95:5)
at next (/home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/layer.js:95:5)
at /home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/index.js:335:12)
at next (/home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/index.js:275:10)
at csp (/home/runner/boilerplate-project-stockchecker-5/node_modules/helmet-csp/dist/index.js:53:13)
at Layer.handle [as handle_request] (/home/runner/boilerplate-project-stockchecker-5/node_modules/express/lib/router/layer.js:95:5)

我该如何解决这个类型错误

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)