【发布时间】:2021-04-03 10:05:48
【问题描述】:
你们是我最后的希望,我花了12个多小时都没能解决问题
应用程序功能齐全,直到我进行了修改并添加了控件
并将campground routes移动到单独的文件“controlers”中,使路由器文件像这样
router.get("/", isLoggedIn, CatchAsync(Campgrounds.index));
router.get("/me", isLoggedIn, CatchAsync(Campgrounds.me));
router.get("/new", isLoggedIn, CatchAsync(Campgrounds.new_camp));
router.post("/new/submit", isLoggedIn, validate, CatchAsync(Campgrounds.submitnew));
router.get("/:id", isLoggedIn, CatchAsync(Campgrounds.show_Camp));
router.get("/:id/edit", isLoggedIn, isAuthenticated, CatchAsync(Campgrounds.edit_Camp));
router.delete("/:id/delete", isLoggedIn, isAuthenticated, CatchAsync(Campgrounds.delete_Camp));
之后应用程序无法运行
Error: Route.get() requires a callback function but got a [object Promise]
这里是沙盒上的项目https://codesandbox.io/s/vigorous-galileo-sdy0w?file=/app.js
【问题讨论】:
标签: node.js express node-modules