July 2017
Beginner to intermediate
340 pages
7h 43m
English
Sanic (http://sanic.readthedocs.io/) is another interesting project, which specifically tries to provide a Flask-like experience with coroutines.
Sanic uses uvloop (https://github.com/MagicStack/uvloop) for its event loop, which is a Cython implementation of the asyncio loop protocol using libuv, allegedly making it faster. The difference might be negligible in most of your microservices, but ;is good to take any speed gain when it is just a transparent switch to a specific event loop implementation.
If we write the previous example in Sanic, it's very close to Flask:
from sanic import Sanic, response
app = Sanic(__name__)
@app.route("/api")
async def api(request):
return response.json({'some': 'data'})
app.run()
Needless to say, ...
Read now
Unlock full access