a util to make iris more beautiful
是一个用iris web框架来完成整体web服务的框架
在_example,go run ./main.go
其中hello服务是有view的web服务 movie服务是api服务 返回view还是api的关键在于controller中方法的返回值,如果是interface{}或具体的struct则为api
controllers -> services -> respositories -> storage
datamodels定义了关键structures
web/controllers/hello_controller.go - GetProfile 逻辑上的校验通常放在service层
common里面定义了错误代码和错误json返回函数 web/controller/movie_controller.go - Get()和GetBy() 给出了实例
use logrus to log access, see common/logger.go
//TODO: logrus will involve several strage spaces //TODO: redis log
mysql使用xorm.io/xorm storage/mysql/index.go repositories/movie_db.go
redis使用github.com/gomodule/redigo/redis storage/redis/index.go repositories/image_repository.go
使用了toml格式
用了iris-toml和github.com/BurntSushi/toml
main.go
必须用form(不可用formfile和json混合模式) movie_controller.go:PostAdd
main_test.go https://github.com/gavv/httpexpect
在线jsonschema生成工具
https://www.liquid-technologies.com/online-json-to-schema-converter
封装到了middleware/cors
返回头加上跨域设置
加入app.AllowMethods(iris.MethodOptions),允许options查询
https://github.com/kataras/iris/tree/master/_examples
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。