前端框架选型是企业提升开发效率与用户体验的关键因素
1061
2022-10-25
xweb 一个具有很少代码的Web框架
xweb
A web framework with very few code.
feature
few codedo moreno dependencies
install
pip install xweb
hello world
from xweb.application import XWebapp = XWeb()@app.route('/')def hello(): return 'hello world!'app.listen(3000)
route
from xweb.application import XWebapp = XWeb()@app.route('/:name/')def call_my_name(name): return 'hi {}!'.format(name)app.listen(3000)
request
from xweb.globals import requestrequest.pathrequest.query_stringrequest.queryrequest.filesrequest.formsrequest.jsonrequest.iprequest.hostnamerequest.headers
response
from xweb.globals import responseresponse.headersresponse.statusresponse.body
middleware
from xweb.application import XWebapp = XWeb()@app.middleware('request')def print_on_request1(): print("I print when a request is received by the server1")@app.middleware('request')def print_on_request2(): print("I print when a request is received by the server2")@app.middleware('response')def print_on_response1(): print("I print when a response is returned by the server1")@app.middleware('response')def print_on_response2(): print("I print when a response is returned by the server2")@app.route('/:name/')def call_my_name(name): return 'hi {}!'.format(name)app.listen(3000)
TODO
important:
auto-reloadtest code
normal:
more http status codesome necessary middleware support blueprinta cool logo
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~