前端框架选型是企业提升开发效率与用户体验的关键因素
734
2022-10-31
Hyper2Web一个开发渐进Web应用的超快速HTTP2框架
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.
Dependency
Python3.6
h2
curio
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 appif __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 appapp.App(port=5000).up()
Docs
Documentation is hosted on hyper2web.readthedocs.io.
Example
See the example folders for examples.
Test
$ python -m unittest discover test
Run all tests under test/ dir.
Misc
Why did I create this framework?
April 23rd, 2017, Sunday, I woke up and felt bored and decided to create my own HTTP2 web framework.
Since I had little or some prior web knowledge, this would be a super learning and fun project for me.
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~