死气沉沉的简单restful wsgi应用程序
dsrw的Python项目详细描述
#dsrw
死的简单restful wsgi应用程序
请求
app=app()
api=app.ns('/api')
@app.get('/hello')
def hello(req:Request):
return{'msg':“hello world!”}
@app.get('/hello/:name')
定义其他(req:Request):
返回{msg':'hello',
“name”:req.param.name}
@api.get('/echo')
def echo(req:Request):
如果请求具有有效的实体:
return req.body
否则:
return[“没有可用的实体”]
if“uu name=''uuuu main':
httpd=make懔server('',8080app)
print(“在端口8080上服务http…”)
响应请求,直到进程终止
死的简单restful wsgi应用程序
请求
app=app()
api=app.ns('/api')
@app.get('/hello')
def hello(req:Request):
return{'msg':“hello world!”}
@app.get('/hello/:name')
定义其他(req:Request):
返回{msg':'hello',
“name”:req.param.name}
@api.get('/echo')
def echo(req:Request):
如果请求具有有效的实体:
return req.body
否则:
return[“没有可用的实体”]
if“uu name=''uuuu main':
httpd=make懔server('',8080app)
print(“在端口8080上服务http…”)
响应请求,直到进程终止