D语言函数用定属的示例

原文

@body("user")
@errorDisplay
auto postUsers(User _user, string  _error)
//变成

auto postUser(@body User user, @errors Errors errors)

而:

@path("/users/:id")
@queryParam("page")
@before!authenticate("user")
auto getUsers(string _id, int page, User user)
//变成.

@path("/users/:id")
auto getUser(@urlParam string id, @queryParam int page, @auth User user)
posted @ 2023-02-28 09:40  zjh6  阅读(17)  评论(0)    收藏  举报  来源