https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/hello.go

main调用

package main

import (
"fmt" "gopkg.in/gin-gonic/gin.v1" "github.com/jinzhu/gorm"
"github.com/wangzitian0/golang-gin-starter-kit/common"
"github.com/wangzitian0/golang-gin-starter-kit/users"
) func Migrate(db *gorm.DB) {
//users.AutoMigrate()
db.AutoMigrate(&users.UserModel{})
db.AutoMigrate(&users.FollowModel{})
} func main() {
db := common.Init()
Migrate(db)
defer db.Close() r := gin.Default() v1 := r.Group("/api")
v1.Use(users.AuthMiddleware(true))
users.UsersRegister(v1.Group("/users"))
users.UserRegister(v1.Group("/user"))
users.ProfileRegister(v1.Group("/profiles")) r.Run() // listen and serve on 0.0.0.0:8080
}

从golang-gin-realworld-example-app项目学写httpapi (七)的更多相关文章

  1. 从golang-gin-realworld-example-app项目学写httpapi (八)

    https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/common/unit_test.go 单元测试 ...

  2. 从golang-gin-realworld-example-app项目学写httpapi (六)

    https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/users/validators.go 验证器 ...

  3. 从golang-gin-realworld-example-app项目学写httpapi (五)

    https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/users/middlewares.go 中间件 ...

  4. 从golang-gin-realworld-example-app项目学写httpapi (四)

    https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/users/routers.go 路由定义 pa ...

  5. 从golang-gin-realworld-example-app项目学写httpapi (三)

    https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/users/serializers.go 序列化 ...

  6. 从golang-gin-realworld-example-app项目学写httpapi (二)

    https://github.com/gothinkster/golang-gin-realworld-example-app/blob/master/users/models.go 模型定义 use ...

  7. 从golang-gin-realworld-example-app项目学写httpapi (一)

    https://wangzitian0.github.io/2013/06/29/zero-to-one-1/ https://github.com/gothinkster/golang-gin-re ...

  8. Golang Gin 项目包依赖管理 godep 使用

    Golang Gin 项目包依赖管理 godep 使用 标签(空格分隔): Go 在按照github.com/tools/godep文档go get完包以后,调整项目结构为$GOPATH/src/$P ...

  9. Golang Gin 项目使用 Swagger

    Golang Gin 项目使用 Swagger 标签(空格分隔): Go 首先需要github.com/swaggo/gin-swagger和github.com/swaggo/gin-swagger ...

随机推荐

  1. JavaScript设计模式-4.继承和聚合

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. ie和火狐事件addEventListener()及attachEvent()区别分析

    Mozilla中: addEventListener的使用方式: target.addEventListener(type, listener, useCapture); target: 文档节点.d ...

  3. 基于Flume做FTP文件实时同步的windows服务。

    需求:做一个windows服务,实现从ftp服务器实时下载或者更新文件到本地磁盘. 功能挺简单的.直接写个ftp工具类用定时器跑就能搞定,那我为什么不用呢? 别问,问就是我无聊啊,然后研究一下Flum ...

  4. WPF中Popup等弹窗的位置不对(偏左或者偏右)

    1.情况如图: 正常情况:         部分特殊情况: 在一般的电脑都能正确显示,就是第一种情况,同样的代码为什么在不同的电脑就会显示不同的位置呢,原来Windows为了满足 不同需求的用户,左撇 ...

  5. 在Linux上创建webrev[基于git]

    在Sun/Oracle工作了N(>12)年后,对webrev工具甚为喜欢,因为其易用性确实非常好.幸运的是,有工程师将webrev工具放到了GitHub上,而且支持git. 下面给出使用webr ...

  6. sqlplus 调试存储过程

    SQLPLUS里测试带返回参数的存储过程过程名p_test入参 aa varchar2出参 bb sys_refcursor 在SQLPLUS里如何将sys_refcursor 这个结果集获取出来呢 ...

  7. IOS折线图

    做项目要统计商品的销售情况,美工那边给了效果图,自己就按照效果图自定义了一个ScrollView.整体效果不错,在做的过程中遇到的问题也记录一下. 现在这个还有许多优化的地方: 1.一个表中只能画一个 ...

  8. 什么是SSH

    SSH不仅实现了视图.控制器与模型的彻底分离,而且还实现了业务逻辑层与持久层的分离,耦合度降低,系统的灵活性更好,可复用性高 官方的说法:SSH是 struts+spring+hibernate的一个 ...

  9. JAVA注释方式

    1.单行(single-line)注释    //…… 2.块(block)注释                /*……*/ 3.文档注释                      /**……*/

  10. 【转】Java策略消除if else

    策略(Strategy)模式:又名Policy,它的用意是定义一组算法,把它们一个个封装起来,并且使他们可以相互替换.策略模式可以独立于使用他们的客户端而变化.GOF策略模式静态结构类图如下: 通过上 ...