Hyper2Web¶
Super Fast HTTP2 Framework for Progressive Web Application
Installation¶
To install Hyper2Web, run this command in your terminal:
$ # due to a known issue, please install Curio manually
$ pip install git+https://github.com/dabeaz/curio.git
$ pip install hyper2web
This is the preferred method to install Hyper2Web, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
Quick Start¶
Assuming you have a directory structure like:
your project/
--public/
--index.html
--index.js
...
--app.py
Your app.py
looks like
from hyper2web import app
if __name__ == '__main__':
# A basic callback style API is provided
# Function name is up to you
async def post_echo(request, response):
# Send the data received back to the client
await response.send(request.stream.data)
app = app.App(port=5000)
app.post('name', post_echo)
app.up()
Then run this script
$ python app.py
That’s it!
If you just want to serve static files, it’s just 2 lines!
from hyper2web import app
app.App(port=5000).up()
Docs¶
Documentation is hosted on hyper2web.readthedocs.io.
Example¶
See the example folders for examples.