kui icon indicating copy to clipboard operation
kui copied to clipboard

使 FileRoutes 支持函数

Open abersheeran opened this issue 3 years ago • 0 comments

使用类固然使局部代码更加紧凑,但是也牺牲了使用的便捷性。遂决定增加使用的函数的注册方式,原有注册方式保持不变。

*.py 文件中未寻找到 HTTP 对象,则寻找如下名称的函数作为对应 HTTP 请求方法的处理函数:"get", "post", "put", "patch", "delete", "head", "options", "trace"。这意味着使用时不需要继承 indexpy.HttpView,直接定义一个名为 get 的异步函数即可处理请求。

在内部代码里,使用 MultimethodRoutes 同等方式,合并多个函数到一个类中。

abersheeran avatar Jun 07 '21 15:06 abersheeran