beego框架利用bee api创建api框架
2014-10-23 18:26
489 查看
首先需要beego框架的环境,若未安装,或者版本太老不具有api功能,请先更新或安装此篇。
1.安装好beego环境
2.利用bee api创建
打开doc窗口,进入到项目src目录下。即root。
bee api基本语法
如果默认是mysql数据,那么可以省略-driver。
在doc下输入命令
进入hello项目目录,输入运行命令
这时候修改内容,都会自动编译运行。
这时候已经自动生成了每个表的增删改查api,可以根据实际需要修改即可。
1.安装好beego环境
2.利用bee api创建
打开doc窗口,进入到项目src目录下。即root。
bee api基本语法
usage: bee api [appname] create an api application base on beego framework bee api [appname] [-tables=""] [-driver=mysql] [-conn=root:@tcp(127.0.0.1:3306)/ test] -tables: a list of table names separated by ',', default is empty, indicating all tables -driver: [mysql | postgres | sqlite], the default is mysql -conn: the connection string used by the driver, the default is '' e.g. for mysql: root:@tcp(127.0.0.1:3306)/test e.g. for postgres: postgres://postgres:postgres@127.0.0.1:5432/postgres
如果默认是mysql数据,那么可以省略-driver。
在doc下输入命令
bee api hello -conn=root:root@tcp(127.0.0.1:3306)/test就会创建一个hello的api项目
进入hello项目目录,输入运行命令
bee run -downdoc=true -gendoc=true运行成功出现以下状态
2014/10/23 19:07:29 [I] Running on :8080 157888 bytes downloaded. start to unzip file from swagger.zip to swagger Start delete src file swagger.zip
这时候修改内容,都会自动编译运行。
这时候已经自动生成了每个表的增删改查api,可以根据实际需要修改即可。
相关文章推荐
- beego和bee的安装、自动生成API框架
- beego和bee的安装、自动生成API框架并用swagger测试
- 利用yahoo天气预报API创建自己的WCF服务
- 创建Java安全框架 避免Java漏洞被利用
- 利用WhiteHose一步步建立分布式系统的框架(二)--创建LDD步骤
- 利用Fck的javascript-API创建fck编辑器
- 利用ASP.NET框架创建网站登陆
- C# Asp.net中的AOP框架 Microsoft.CCI, Mono.Cecil, Typemock Open-AOP API, PostSharp -摘自网络 (可以利用反射 Attribute 进行面向切面编程 可以用在记录整个方法的Log方面)
- 深入浅出学习Struts1框架(十一)-利用ActionMapping来创建ActionForm
- 利用WhiteHose一步步建立分布式系统的框架(三)--创建AD步骤(定义AD的第一部分)
- 利用OpenStack Rest API 创建镜像
- 创建透明图片(利用API)
- 利用Azure Rest API 创建虚拟机
- 深入浅出学习Struts1框架(十一)-利用ActionMapping来创建ActionForm
- 八十八、基础框架(四十六)归档-利用 NSData这类物件 创建 自己的归档
- 利用ASP.NET框架创建网站登陆
- 利用WhiteHose一步步建立分布式系统的框架(四)--创建AD步骤(定义AD的第二部分)
- VB 利用API创建窗体的模块代码
- 利用ASP.NET框架创建网站登陆