# restful-api-demo **Repository Path**: frankgty/restful-api-demo ## Basic Information - **Project Name**: restful-api-demo - **Description**: https://github.com/wu-wenxiang/restful-api-demo.git - **Primary Language**: Python - **License**: GPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-04-27 - **Last Updated**: 2022-04-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Rest API Web Service - Github: - 同步到 Gitee: ## 本地调试 ```bash # 创建 python 虚拟环境 python -m virtualenv .venv # 进入 python 虚拟环境 . .venv/bin/activate # 安装依赖 pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt # 清理 sqlite 数据库 && 初始化数据库 rm -rf /tmp/rest-demo.db && python datainit.py # 启动 web 服务 python run.py # python run.py 0.0.0.0 8080 # 尝试访问 curl http://localhost:8080/ ``` ## 单元测试和代码格式检查 ```bash # python setup.py test -q # stestr run tox ``` ## 接口测试 ```bash cd gabbi ls *.yaml | xargs gabbi-run localhost:8080 -- # show verbose gabbi-run -v all localhost:8080 -- crud-user.yaml ``` ## 容器镜像制作和部署 ```bash docker build -t rest-demo . docker stop rest-demo; docker rm rest-demo docker run -d --name rest-demo -p 8888:8080 rest-demo curl http://localhost:8888/ ``` ## Details 1. [如何搭建一个用于生产的 Restful API 框架?](doc/how-to-build-rest-api-web-service.md)