A web framework with very few code.
- no dependencies
- very few code
- easy to use
pip install xweb
from xweb.application import XWeb
app = XWeb()
@app.route('/')
def hello():
return 'hello world!'
app.listen(3000)from xweb.application import XWeb
app = XWeb()
@app.route('/:name/')
def call_my_name(name):
return 'hi {}!'.format(name)
app.listen(3000)from xweb.globals import request
request.path
request.query_string
request.query
request.files
request.forms
request.json
request.ip
request.hostname
request.headersfrom xweb.globals import response
response.headers
response.status
response.bodyfrom xweb.application import XWeb
app = 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)-
pip install -r requirement.txt -
pytest
- star
- fork
- add your code
- add test code and run test
- pull request
- auto-reload
- more test code
- rewrite global request and response
- more http status code
- some necessary middleware
- support blueprint
- a cool logo