微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。