简单路由

所谓的路由并不是我们一般所说的路由器的路由,而是通过不同的网址,给用户显示不同的信息,这叫做路由。

在luyA中,您可以使用框架提供的route函数去注册你想要的路由,让我们来看一下简单的例子

from luya import Luya
from luya import response

app = Luya()

@app.route('/get')
async def helloWorld(request):
    return response.text('this is get method')


@app.route('/')
async def helloWorld(request):
    return response.text('hello,world')

if __name__ == '__main__':
    app.run()

results matching ""

    No results matching ""