You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
route: the restful api
handler: an async function which accepts only one argument, an EndPointHandler
async def get_name(handler):
print('GET name hit')
await handler.send_and_end('GET name hit')
app.get('name', get_name)
class EndPointHandler
A top level API user should never construct it. It is only passed by the framework to the app.get's async callback function.
async def send_and_end(self, data)
send data to the client. data type could be any, but recommendation is str
this will end a HTTP/2 stream
async def send_file(self, file_path)
send a file in your filesystem
this will end a HTTP/2 stream
If you want to send a file, this function is recommended. If you use the send_and_end function, you have to do the flow control yourself, which is not fun.