【发布时间】:2020-12-26 22:40:31
【问题描述】:
我正在尝试使用 dart 中的 Aqueduct 创建后端服务器。我正在尝试创建一个资源控制器来处理帐户问题。
路由代码是这样的;
router
.route("/$apiEntryPointUrl/account/:operation").link(() => AccountController(context, authServer));
当我尝试像这样测试路由器路径变量时;
@Operation.post("asdf")
Future<Response> test() async {
return Response.ok("testsuccess");
}
@Operation.post("operation")
Future<Response> test5() async {
return Response.ok("bugsuccess");
}
@Operation.post("test3")
Future<Response> test2() async {
return Response.ok("testsucces3333s");
}
当我添加 Operation.post("operation") 作为路径变量时,我传递给变量的任何内容都会转到此函数。如果我发出一个喜欢 /account/tes2 的帖子请求,它会调用 test5() 函数。这是正常的吗?我是否缺少一些基础知识?
【问题讨论】: