问题描述
我运行这个例子:https://flask-restx.readthedocs.io/en/latest/example.html (带有 Flask-RESTX 的 Python REST-API)
代码片段
app = Flask(__name__)
api = Api(app,...)
ns = api.namespace('todos',...)
@ns.route('/')
...
@ns.route('/<int:id>')
...
结果
我获得了 REST-API 的以下 URL:
http://127.0.0.1:5000 -> Swagger 文档
http://127.0.0.1:5000/swagger.json
http://127.0.0.1:5000/todos/{id}
问题
我想用 Javascript 实现一个 Web 客户端,可以通过以下 URL 访问:
http://127.0.0.1:5000 -> index.html
http://127.0.0.1:5000/style.css
REST-API 的 URL 应更改为:
http://127.0.0.1:5000/api -> Swagger 文档
http://127.0.0.1:5000/api/swagger.json
http://127.0.0.1:5000/api/todos/
http://127.0.0.1:5000/api/todos/{id}
如何扩展示例以生成所需的 URL?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)