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. winform MD5加密

    byte[] result = Encoding.Default.GetBytes(this.tbPass.Text.Trim());    //tbPass为输入密码的文本框MD5 md5 = ne ...

  2. HTML5 表单 中

    input 属性 autofocus 页面加载时自动获得焦点 required   非空字段输入框 placeholder 提供一种提示(hint),输入域为空时显示. pattern 规定验证inp ...

  3. MultipartFile的使用小结

    Multipartfile转File?File转MultipartFile?可千万别转晕了. 题图:from Google 1. MultipartFile类型转File类型 想要将Multipart ...

  4. HDOJ 5019 Revenge of GCD

    Revenge of GCD In mathematics, the greatest common divisor (gcd), also known as the greatest common ...

  5. EntityFrameworkCode 操作MySql 相关问题

    近段时间,由于工作原因,使用到了EntityFrameworkCore 操作MySql数据库,使用中遇到一些问题,特此记录 系统环境 Win10 1805,VS 2017,Framework:Asp. ...

  6. 使用Jprofiler+jmeter进行JVM性能调优

    一.JProfiler简介 JProfiler 是一个商业授权的Java剖析工具,由EJ技术有限公司,针对的Java EE和Java SE应用程序开发的.它把CPU.执行绪和内存的剖析组合在一个强大的 ...

  7. 汇编语言、与C语言、实现--汉诺塔--

    题意描述:   用汇编语言实现汉诺塔.只需要显示移盘次序,不必显示所移盘的大小,例如: X>Z,X>Y,Z>Y,X>Z,..... (n阶Hanoi塔问题)假设有三个分别命名为 ...

  8. nextval 遍历ResultSet,行列要从1开始

    nextval nextval与序列关联,表示下一个,如:创建里一个序列seq_1:#序列一般表示第几行,起标识作用create sequence seq_1 increment by 1 start ...

  9. php 截取中文字符串方法

    /** * 截取中文字符串函数 * @param $str 需要截取的字串 * @param $start 开始截取的位置 * @param $length 截取的长度 * @return 此函数返回 ...

  10. OpenStack 组成 架构

    Components of OpenStack OpenStack is on a mission: to provide scalable, elastic cloud computing for ...